[HELP]: When server shutting down..
#1

Hello everybody,

I have a problem about SII include.( saving stats) When server.exe closed player's stats resetting..I using SII register/login system..


Here's my onplayerdisconnect codes;

pawn Code:
if(INI_Open(getINI(playerid))) {

    INI_WriteInt("Level",PlayerInfo[playerid][pLevel]);
    INI_WriteInt("Money",GetPlayerMoney(playerid));
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt("Sex",PlayerInfo[playerid][pCinsiyet]);
    INI_WriteInt("Skin",GetPlayerSkin(playerid));
    INI_WriteInt("Age",PlayerInfo[playerid][pYas]);
    INI_WriteInt("Origin",PlayerInfo[playerid][pUyruk]);

    INI_Save();
    INI_Close();
    }
Already thanks for help.
Reply
#2

Try putting that code into a custom classback.

pawn Code:
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
    if(INI_Open(getINI(playerid)))
    {
        INI_WriteInt("Level",PlayerInfo[playerid][pLevel]);
        INI_WriteInt("Money",GetPlayerMoney(playerid));
        INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
        INI_WriteInt("Sex",PlayerInfo[playerid][pCinsiyet]);
        INI_WriteInt("Skin",GetPlayerSkin(playerid));
        INI_WriteInt("Age",PlayerInfo[playerid][pYas]);
        INI_WriteInt("Origin",PlayerInfo[playerid][pUyruk]);
        INI_Save();
        INI_Close();
    }
    return 1;
}
Then under OnPlayerDisconnect just call the function
pawn Code:
SavePlayer(playerid);
Reply
#3

Doesnt work :/
Reply
#4

Oh i read your whole topic wrong. If you don't have the foreach include click here to download it.

pawn Code:
public OnGameModeExit()
{
    foreach(player, i)
    {
        if(IsPlayerConnected(i))
        {
            //if(LoggedIn[i] == 1) ** Optional depending on your code
            SavePlayer(i);
        }
    }
    return 1;
}
Keep using that function and OnPlayerDisconnect saving method above.
Reply
#5

Again, doesnt work :/
This time char stats full resetting..I mean is when i join to server, then this time char's stat resetting. :/
Reply
#6

I need to help for this. :S
Reply
#7

i solved thanks a lot !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)