25.06.2011, 13:56
Hey everyone. My stats are mixing up with players. So when someone's age is 20 someone else's age will be be stted to 20 as well. What's wrong?
pawn Код:
if (dialogid == LOGIN)
{
format(file, sizeof(file), SERVER_USER_FILE, Name);
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_GREY, "This password doesn't match with your account.");
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
PlayerInfo[playerid][pGender] = dini_Int(file, "Gender");
PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
PlayerInfo[playerid][pNationality] = dini_Int(file, "Nationality");
SendClientMessage(playerid,COLOR_ORANGE, "Successfully logged in!");
SpawnPlayer(playerid);
SetCameraBehindPlayer(playerid);
SetTimer("SaveStats", 1000, true);
SetTimerEx("SpawnTimer",50,0,"d",playerid);
}
return 1;
}
pawn Код:
public SaveStats(playerid)
{
GetPlayerName(playerid, Name, sizeof Name);
format(file, sizeof file, SERVER_USER_FILE, Name);
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
SetPlayerMoney(playerid,PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
return 1;
}