SA-MP Forums Archive
Need help with Stats Saving. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with Stats Saving. (/showthread.php?tid=387764)



Need help with Stats Saving. - Majava - 26.10.2012

Pastebin <--- Link.
I made this from Kush's tutorial and i have something wrong it doesnt save stats/load. In file 0's doesnt change i see-> scriptfiles/Users/Name.txt
PHP код:
[data]
Password = ***
Admin 0
Cash 
0
Kills 
0
Deaths 
0
Cookies 

I have /Kill wich add death and when player die it adds death so when i type /stats it showing me 2deaths but it doesn't save i writed from that tutorial with my own hands because i want learn Something is wrong?


Re: Need help with Stats Saving. - newbienoob - 26.10.2012

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s left from server!",pName);
    SendClientMessageToAll(COLOR_GREY,string);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
   INI_Close(File); //Close the file
    return 1;
}



Re: Need help with Stats Saving. - Majava - 26.10.2012

Quote:
Originally Posted by newbienoob
Посмотреть сообщение
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s left from server!",pName);
    SendClientMessageToAll(COLOR_GREY,string);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
   INI_Close(File); //Close the file
    return 1;
}
Thank you!!!