Scores Not 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: Scores Not saving (
/showthread.php?tid=562318)
Scores Not saving -
Rissam - 08.02.2015
when I use the cmd "/setscore amount" the score doesnot gets save in the scriptfile folder. I need help.
Re: Scores Not saving -
malackovgfx - 08.02.2015
Can you show us your OnPlayerDisconnect ?
Re: Scores Not saving -
Rissam - 08.02.2015
Quote:
Originally Posted by malackovgfx
Can you show us your OnPlayerDisconnect ?
|
PHP код:
ppublic OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Scores",PlayerInfo[playerid][pScores]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_Close(File);
return 1;
}
Re: Scores Not saving -
CalvinC - 08.02.2015
Show us your "setscore" command too.
Re: Scores Not saving -
malackovgfx - 08.02.2015
EDITED: The one under me found it.
Re: Scores Not saving -
Rissam - 08.02.2015
I have found the problem
instead of this
Quote:
INI_WriteInt(File,"Scores",PlayerInfo[playerid][pScores]);
|
I have to do this
Quote:
INI_WriteInt(File,"Scores",GetPlayerScore(playerid ));
|
Re: Scores Not saving -
Rissam - 08.02.2015
lol now another error when I use /setscore it gets save in the script file folder but when I reconnect score becomes 0 again.
Re: Scores Not saving -
Rissam - 09.02.2015
please help
Re: Scores Not saving -
De4dpOol - 09.02.2015
Just a guess....
I think when you connect your score is loaded as
PlayerInfo[playerid][pScores]. You must have to do
SetPlayerScore(playerid, PlayerInfo[playerid][pScores]) after loading account info.
Re: Scores Not saving -
Rissam - 10.02.2015
this is my on player connect
PHP код:
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Registering...","Type your password below to register a new account.","Register","Quit");
}
return 1;
}
is there any error?