Ein Teil fehlt mir beim Laden: Ich brauch die Zeile wo du mysql_function_query für den Callback OnPasswordResponse aufrufst.
Sonst sehe ich so auf den Hinblick überhaupt nichts.
//Login/Register
new name[MAX_PLAYER_NAME],query[128];
GetPlayerName(playerid,name,sizeof(name));
format(query,sizeof(query),"SELECT id FROM user WHERE username='%s'",name);
mysql_function_query(dbhandle,query,true,"OnUserCheck","i",playerid);
savePlayer(playerid)
{
if(sInfo[playerid][eingeloggt]==0)return 1;
//speichern
new query[128];
format(query,sizeof(query),"UPDATE user SET level='%i',money='%i',alevel='%i' WHERE id='%i'",sInfo[playerid][level],
GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][db_id]);
mysql_function_query(dbhandle,query,false,"","");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][id_x]==0)continue;
if(cInfo[i][besitzer]!=sInfo[playerid][db_id])continue;
GetVehiclePos(cInfo[i][id_x],cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z]);
GetVehicleZAngle(cInfo[i][id_x],cInfo[i][c_r]);
new query[256];
format(query,sizeof(query),"UPDATE autos SET x='%f',y='%f',z='%f',r='%f' WHERE id='%i'",cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z],cInfo[i][c_r],cInfo[i][db_id]);
mysql_function_query(dbhandle,query,false,"","");
DestroyVehicle(cInfo[i][id_x]);
cInfo[i][id_x]=0;
}
savePlayer(playerid);
resetPlayer(playerid);
if(newbie[playerid]) DestroyVehicle(newbie[playerid]),newbie[playerid]=0;
return 1;
}
saveCarToDB(playerid,carid)
{
new query[128];
format(query,sizeof(query),"INSERT INTO autos (besitzer,model,x,y,z,r) VALUES ('%i','%i','%f','%f','%f','%f')",sInfo[playerid][db_id],cInfo[carid][model],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r]);
mysql_function_query(dbhandle,query,true,"carSavedToDB","i",carid);
return 1;
}
loadPlayerCars(playerid)
{
new query[128];
format(query,sizeof(query),"SELECT * FROM autos WHERE besitzer='%i'",sInfo[playerid][db_id]);
mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i",playerid);
return 1;
}
public OnPasswordResponse(playerid)
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(num_rows==1)
{
//Spieler laden
sInfo[playerid][eingeloggt] = 1;
sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
SetPlayerScore(playerid,sInfo[playerid][level]);
sInfo[playerid][db_id] = cache_get_field_content_int(0,"id",dbhandle);
SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));
sInfo[playerid][alevel] = cache_get_field_content_int(0,"alevel",dbhandle);
SendClientMessage(playerid,GRÜN,"Erfolgreich eingeloggt!");
loadPlayerCars(playerid);
}
else
{
SendClientMessage(playerid,ROT,"Das eigegeben Passwort ist fasch");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Willkommen auf Red-Game0v3r-Reallife,\n\n\n\n Bitte logge dich nun ein!\n\n\n","Login","Abbrechen");
}
return 1;
}
if(dialogid==DIALOG_REGISTER)
{
if(response)
{
new name[MAX_PLAYER_NAME],query[128],passwort[35];
GetPlayerName(playerid,name,sizeof(name));
if(strlen(inputtext)>3)
{
//Registrierungsfunktion
mysql_escape_string(inputtext,passwort,dbhandle);
format(query,sizeof(query),"INSERT INTO user (username,password) VALUES ('%s','%s') ",name,passwort);
mysql_function_query(dbhandle,query,false,"OnPlayerRegister","d",playerid);
}
else
{
//Kleiner als 4 Zeichen
SendClientMessage(playerid,ROT,"Dein Passwort muss mindestens 4 Zeichen lang sein.");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Registrierung","Gib bitte dein gewünschtes Passwort an:","Okay","Abbrechen");
}
}
else
{
Kick(playerid);
}
return 1;
}
return 1;
}
public OnPlayerRegister(playerid)
{
sInfo[playerid][db_id] = mysql_insert_id();
SendClientMessage(playerid, ROT, "Du hast dich Erfolgreich Registriert !");
SendClientMessage(playerid, LEUCHTENDBLAU, "=====>Willkommen auf Red-Game0v3r-Reallife<=====");
SetPlayerMoney(playerid, 2500);
SetPlayerScore(playerid,1);
SetPlayerColor(playerid, 0xFF00FFFF);
}