Save problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Save problem (
/showthread.php?tid=240415)
Save problem -
FrankC - 15.03.2011
Hey, I have made a level system and it saves find and all works if your in-game but if you rejoin
or the server restarts all exp and levels gets reset to 0 but only when you join.
What could be the problem and if you need some codes please let me know.
Re: Save problem -
Pangea - 15.03.2011
I assume you're using files?
Show the code that save the players stats.
Make sure you run that code when a player leaves the server, or when the server gets restarted.
Re: Save problem -
FrankC - 15.03.2011
I have them set here:
pawn Код:
enum PlayerStatistics
{
EXP,
Level,
};
pawn Код:
stock Reset( playerid )
{
Player[playerid][EXP] = 0;
Player[playerid][Level] = 0;
return 1;
}
pawn Код:
public SavePlayerData( playerid )
{
if( Player[playerid][Authenticated] == 1)
{
dini_IntSet( string, "EXP", Player[playerid][EXP] );
dini_IntSet( string, "Level", Player[playerid][Level] );
}
return 1;
}
EDIT: I think i found the problem i forgot to set them at "OnPlayerLoginAttempt"