
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new INI:File = INI_Open(UserPath(i));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(i));
INI_WriteInt(File,"Score",GetPlayerScore(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);
}
}
CMD:gmx(playerid)
{
SaveStats(playerid);
SetTimer(#Restart, 2 * 1000, 0);
}
forward Restart();
public Restart()
{
SendRconCommand(#gmx);
}
stock SaveStats(playerid)
{
//put what u have on player disconnect here and they u have it player stats saved
return 1;
}
eg of my savestats
/*
stock SaveStats(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Years", GetPlayerScore(playerid));
INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"House1",PlayerInfo[playerid][pHouse1]);
INI_WriteInt(File,"House2",PlayerInfo[playerid][pHouse2]);
INI_WriteInt(File,"House3",PlayerInfo[playerid][pHouse3]);
INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper]);
INI_WriteInt(File,"NMute",PlayerInfo[playerid][pNMute]);
INI_WriteInt(File,"VHouse",PlayerInfo[playerid][pVHouse]);
INI_WriteInt(File,"Bizey",PlayerInfo[playerid][pBiz]);
INI_WriteInt(File,"VBizkey",PlayerInfo[playerid][pVBiz]);
INI_WriteInt(File,"Viplvl",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"pHouse",PlayerInfo[playerid][pHouse]);
INI_WriteInt(File,"Cigar",PlayerInfo[playerid][pCigar]);
INI_WriteInt(File,"HPhone",PlayerInfo[playerid][pHasCellphone]);
INI_WriteInt(File,"Phone",PlayerInfo[playerid][pCellphone]);
INI_WriteInt(File,"PhoneBook",PlayerInfo[playerid][pPhonebook]);
INI_WriteInt(File,"Dice",PlayerInfo[playerid][pDice]);
INI_WriteInt(File,"Sprunk",PlayerInfo[playerid][pSprunk]);
INI_WriteInt(File,"Rope",PlayerInfo[playerid][pRope]);
INI_WriteInt(File,"BFold",PlayerInfo[playerid][pBlindfold]);
INI_WriteInt(File,"Spray",PlayerInfo[playerid][pSpray]);
INI_WriteInt(File,"walkietalkie",PlayerInfo[playerid][pWT]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Ban",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
*/
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}

|
Код:
CMD:gmx(playerid)
{
SaveStats(playerid);
SetTimer(#Restart, 2 * 1000, 0);
}
forward Restart();
public Restart()
{
SendRconCommand(#gmx);
}
Код:
stock SaveStats(playerid)
{
//put what u have on player disconnect here and they u have it player stats saved
return 1;
}
eg of my savestats
/*
stock SaveStats(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Years", GetPlayerScore(playerid));
INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"House1",PlayerInfo[playerid][pHouse1]);
INI_WriteInt(File,"House2",PlayerInfo[playerid][pHouse2]);
INI_WriteInt(File,"House3",PlayerInfo[playerid][pHouse3]);
INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper]);
INI_WriteInt(File,"NMute",PlayerInfo[playerid][pNMute]);
INI_WriteInt(File,"VHouse",PlayerInfo[playerid][pVHouse]);
INI_WriteInt(File,"Bizey",PlayerInfo[playerid][pBiz]);
INI_WriteInt(File,"VBizkey",PlayerInfo[playerid][pVBiz]);
INI_WriteInt(File,"Viplvl",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"pHouse",PlayerInfo[playerid][pHouse]);
INI_WriteInt(File,"Cigar",PlayerInfo[playerid][pCigar]);
INI_WriteInt(File,"HPhone",PlayerInfo[playerid][pHasCellphone]);
INI_WriteInt(File,"Phone",PlayerInfo[playerid][pCellphone]);
INI_WriteInt(File,"PhoneBook",PlayerInfo[playerid][pPhonebook]);
INI_WriteInt(File,"Dice",PlayerInfo[playerid][pDice]);
INI_WriteInt(File,"Sprunk",PlayerInfo[playerid][pSprunk]);
INI_WriteInt(File,"Rope",PlayerInfo[playerid][pRope]);
INI_WriteInt(File,"BFold",PlayerInfo[playerid][pBlindfold]);
INI_WriteInt(File,"Spray",PlayerInfo[playerid][pSpray]);
INI_WriteInt(File,"walkietalkie",PlayerInfo[playerid][pWT]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Ban",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_Close(File);
return 1;
}
*/
|