Save problem
#1

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.
Reply
#2

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.
Reply
#3

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"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)