Saving after GMX and Crash
#5

Quote:
Originally Posted by Tee
Посмотреть сообщение
Even better.

pawn Код:
new FileSave[20]
When the player logins in

pawn Код:
FileSave[playerid] = SetTimerEx("Save",1000,true,"i",playerid)
pawn Код:
forward Save(playerid)
public Save(playerid)
{
     //Then put the dini stuff in here
     return 1;
}

public OnPlayerDisconnect(playerid)
{
     KillTimer(FileSave[playerid);
     return 1;
}
Here is the 1st 14 lines of mine

pawn Код:
public Save(playerid)
{
    if(Logged[playerid] == 1 && Spawned[playerid] == 1 && IsSpecing[playerid] == 0 && !IsPlayerNPC(playerid))
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(file, sizeof(file), USER_FILES, Name);
        if(dini_Exists(file))
        {
            dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
            dini_IntSet(file, "Score", GetPlayerScore(playerid));
        }
    }
    return 1;
}
I wouldn't advise using that code. Unless you increase the time on the timer. There is no reason i can think of to save every players stats every second. Its very inefficient, especially with dini. Once a minute or even two would be good IMO.

Put this in your timer too,
pawn Код:
dini_IntSet(file, "skin", GetPlayerSkin(playerid));
Reply


Messages In This Thread
Saving after GMX and Crash - by Ihsan-Cingisiz - 28.03.2011, 21:10
Re: Saving after GMX and Crash - by Ihsan-Cingisiz - 28.03.2011, 21:16
Re: Saving after GMX and Crash - by Tee - 28.03.2011, 22:11
Re: Saving after GMX and Crash - by Ihsan-Cingisiz - 29.03.2011, 12:40
Re: Saving after GMX and Crash - by iggy1 - 29.03.2011, 12:48
Re: Saving after GMX and Crash - by Ihsan-Cingisiz - 29.03.2011, 19:41
Re : Saving after GMX and Crash - by timaoux - 17.10.2011, 03:12
Re: Saving after GMX and Crash - by Buzzbomb - 17.10.2011, 04:50

Forum Jump:


Users browsing this thread: 1 Guest(s)