Saving, GMX and Disconnect
#4

https://sampforum.blast.hk/showthread.php?tid=273088
pawn Code:
new LoggedIn[MAXPLAYERS];

onplayerspawn = LoggedIn[playerid]

CMD:gmx(playerid, params[])
{
    foreach(Player, i)
    {
        SaveStats();
        LoggedIn[i] = 0;
        SendClientMessage(playerid, -1, "SERVER: The server is being restarted.");
    }
    SendRconCommand("gmx");
    return 1;
}


forward SaveStats();

public SaveStats() //this is a shell on how to do it replace playerid with i
{
Foreach(Player, i)
{
if(LoggedIn[i])
{
// https://sampforum.blast.hk/showthread.php?tid=273088// the disconnect stuff, replace playerid with i
new INI:File = INI_Open(UserPath(i));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(i));
    INI_WriteInt(File,"Admin",PlayerInfo[i][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[i][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[i][pDeaths]);
    INI_Close(File);
}
}
return 1;
}
Reply


Messages In This Thread
Saving, GMX and Disconnect - by willsuckformoney - 04.11.2012, 21:33
Re: Saving, GMX and Disconnect - by zDivine - 04.11.2012, 21:34
Re: Saving, GMX and Disconnect - by willsuckformoney - 04.11.2012, 21:37
Re: Saving, GMX and Disconnect - by Glad2BeHere - 04.11.2012, 22:01
Re: Saving, GMX and Disconnect - by zDivine - 04.11.2012, 22:04
Re: Saving, GMX and Disconnect - by ReneG - 04.11.2012, 22:05
Re: Saving, GMX and Disconnect - by willsuckformoney - 04.11.2012, 22:06
Re: Saving, GMX and Disconnect - by Glad2BeHere - 04.11.2012, 22:11
Re: Saving, GMX and Disconnect - by ReneG - 04.11.2012, 22:16
Re: Saving, GMX and Disconnect - by JhnzRep - 05.11.2012, 00:39

Forum Jump:


Users browsing this thread: 2 Guest(s)