Hallo unswa habe ich gerade ein fehler gefunden wenn ich mich Registriere und bekomme ich Level 1 und bekomme 2500 aber wenn ich raus gehe und mich wieder einlogge ist mein level auf 0 Gesetzt und mein Geld ebenfalls ?
//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,"","");
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);
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 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);
}
oder Liegt es vlt hier dranne ?
resetPlayer(playerid)
{
sInfo[playerid][level]=0;
sInfo[playerid][eingeloggt]=0;
sInfo[playerid][db_id]=0;
sInfo[playerid][alevel]=0;
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;
}