Restarting & Saving player files
#1

Well, i'm looking for a command that will make sure that before it restarts the server, it will save every single player's file.. Currently I have the following command:

pawn Code:
COMMAND:restart(playerid, params[])
{
    new File[50];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        format(File, sizeof(File), PFiles, pName(i));
        GetPlayerPos(i, PVar[i][pLastX], PVar[i][pLastY], PVar[i][pLastZ]);
        djSetInt        (File, "Kills",     PVar[i][pKills]);
        djSetInt        (File, "Deaths",    PVar[i][pDeaths]);
        djSetInt        (File, "Admin",     PVar[i][pAdmin]);
        djSetInt        (File, "Level",     PVar[i][pLevel]);

        djSetFloat      (File, "LastX",     PVar[i][pLastX]);
        djSetFloat      (File, "LastY",     PVar[i][pLastY]);
        djSetFloat      (File, "LastZ",     PVar[i][pLastZ]);
        printf("%s has been saved.", pName(i));
               //What's the function to make the server restart itself? I don't remember. OnGameModeExit(?)
    }
    return 1;
}
But the problem with this is, it just spams a print with a blank name 500 times, and doesn't actually save the file.
Reply


Messages In This Thread
Restarting & Saving player files - by Skylar Paul - 11.03.2011, 23:07
Re: Restarting & Saving player files - by airsoft - 11.03.2011, 23:58
Re: Restarting & Saving player files - by Skylar Paul - 12.03.2011, 00:01
Re: Restarting & Saving player files - by [L3th4l] - 12.03.2011, 00:03
Re: Restarting & Saving player files - by airsoft - 12.03.2011, 00:09

Forum Jump:


Users browsing this thread: 1 Guest(s)