26.03.2013, 18:46
Hello, this is a problem that im expecting from some days, having a server with a medium playerbase is a problem. Sometimes players lose their score and cash, i dont know why. This is the dialog of the login:
This is OnPlayerConnect that ask if the player is registered or not:
Can you guys find some mistakes? I dont see nothing, sometimes if i login my score and money are resetted to 0. I have saving variables when a player disconnect, also a timer that save players stats every 5 minutes.
pawn Код:
if(dialogid == dlogin)
{
if(!response)
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"{FFDD00}Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
return 1;
}
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
SetPlayerScore(playerid, pInfo[playerid][Scores]);
GivePlayerMoney(playerid, pInfo[playerid][Cash]);
SetPlayerWantedLevel(playerid, pInfo[playerid][Rank]);
new kname[24];
GetPlayerName(playerid, kname, 24);
new welcome1[128];
format(welcome1, sizeof(welcome1), "Welcome back ~r~%s!",kname);
GameTextForPlayer(playerid,welcome1,5000,4);
SetTimerEx("CheckBan", 1000, false, "i", playerid);
new string[150];
format(string,sizeof(string),"** System: Logged in as {F70505}%s {FFFFFF}- Level: {F70505}%d",AdminLevelToName(playerid),pInfo[playerid][Admin]);
SCM(playerid,-1,string);
new lll[200];
format(lll, sizeof(lll), "%s (%d) - %s (%d)", RankName(playerid),pInfo[playerid][Rank],AdminLevelToName(playerid),pInfo[playerid][Admin]);
Update3DTextLabelText(RankLabel[playerid], GetTeamColor(playerid), lll);
Attach3DTextLabelToPlayer(RankLabel[playerid], playerid, 0.0, 0.0, 0.6);
Rules(playerid);
return 1;
}
else
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"{FFDD00}Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
new Year, Month, Day, Hour, Minute, Second;
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
new echo[270];
new kname[24];
GetPlayerName(playerid, kname, 24);
new IP[16];
GetPlayerIp(playerid, IP, 16);
format(echo,sizeof(echo),"0,3%s (%d) (IP: %s) failed to login in his account - %02d:%02d:%02d - %02d:%02d:%02d",kname,playerid,IP,Day,Month,Year,Hour,Minute,Second);
FailedLogins(echo);
}
}
}
pawn Код:
GetPlayerName(playerid,name,sizeof(name));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"{FFDD00}Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"{FFDD00}Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}