irccmd:restart saving player stats Y_INI
#1

OnPlayerDisconnect, it saves score, wantedlevel everything
PHP код:
//Public OnPlayerDisconnect.
public OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"Player's Data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    
INI_WriteInt(File,"WantedLevel",GetPlayerWantedLevel(playerid));
    
INI_WriteInt(File,"AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    
INI_WriteInt(File,"Army",PlayerInfo[playerid][pArmy]);
    
INI_WriteInt(File,"BankAccount",PlayerInfo[playerid][pBankAccount]);
    
INI_WriteInt(File,"Datasaved",PlayerInfo[playerid][pAccountdata]);
    
INI_WriteInt(File,"Arrests",PlayerInfo[playerid][pArrests]);
    
INI_WriteInt(File,"Robberies",PlayerInfo[playerid][pRobberies]);
    
INI_WriteInt(File,"Hits",PlayerInfo[playerid][pHits]);
    
INI_WriteInt(File,"Tazers",PlayerInfo[playerid][pTazers]);
    
INI_WriteInt(File,"Heals",PlayerInfo[playerid][pHeals]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"AntiBanned",PlayerInfo[playerid][pABanned]);
    
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    
INI_WriteInt(File,"Jail",PlayerInfo[playerid][pJail]);
    
INI_Close(File);
    
//Other stuff

but !restart
PHP код:

//Command RESTART.
IRCCMD:restart(botidchannel[], user[], host[], params[])
{
    new 
string[256];
    new 
msg[128];
    new 
playerid;
    
format(stringsizeof(string), "***[SERVER RESTART] Server restarting, all players data have been saved."user);
    
SendClientMessageToAll(0x0000FFFFstring);
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"Player's Data");
    
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    
INI_WriteInt(File,"WantedLevel",GetPlayerWantedLevel(playerid));
    
INI_WriteInt(File,"AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    
INI_WriteInt(File,"Army",PlayerInfo[playerid][pArmy]);
    
INI_WriteInt(File,"BankAccount",PlayerInfo[playerid][pBankAccount]);
    
INI_WriteInt(File,"Datasaved",PlayerInfo[playerid][pAccountdata]);
    
INI_WriteInt(File,"Arrests",PlayerInfo[playerid][pArrests]);
    
INI_WriteInt(File,"Robberies",PlayerInfo[playerid][pRobberies]);
    
INI_WriteInt(File,"Hits",PlayerInfo[playerid][pHits]);
    
INI_WriteInt(File,"Tazers",PlayerInfo[playerid][pTazers]);
    
INI_WriteInt(File,"Heals",PlayerInfo[playerid][pHeals]);
    
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    
INI_WriteInt(File,"AntiBanned",PlayerInfo[playerid][pABanned]);
    
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    
INI_WriteInt(File,"Jail",PlayerInfo[playerid][pJail]);
    
INI_Close(File);
    
    
format(msgsizeof(msg), "02[SERVER RESTART] Server restarting, all players data have been saved.");
    
IRC_GroupSay(groupIDIRC_CHANNELmsg);
    
IRC_GroupSay(groupIDADMIN_CHANNELmsg);
    if(!
IRC_IsAdmin(botidchanneluser)) return 0;
    
SendRconCommand("gmx");
    return 
1;

and when I remove new playerid; errors

someone?
Reply
#2

There are no "playerid" parameters in IRC commands.
Reply
#3

Also if you send the GMX before saving, it wont save the player file.
Reply
#4

I don't know much about IRC but you can use a loop to loop through all of the players then save their stats.
Reply
#5

So, any idea how to save the stats..
and ALSO, it resets the player wantedlevel to 0
and score to 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)