04.11.2012, 22:01
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;
}