20.05.2012, 01:00
Well here is what i do for my saving accounts, i just made a stock and then call the stock when the player disconnects or on my 10 min auto save timer but i have yet to put this so the when the server restarts, but i assume if you put this under OnGamemodeExit it would save it all
that is my players saving system and saving players settings. then under ongamemodeexit put this
Just add your saving code to the stock and you can use it anywhere you want the players file to save, if you have a restart command make sure to loop and save like i did in the ongamemodeexit.
pawn Код:
stock SavePinfo(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",PlayerInfo[playerid][pCash]);
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
INI_WriteInt(File,"Online",PlayerInfo[playerid][pLoggedIn]);
INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
INI_WriteInt(File,"Bans",PlayerInfo[playerid][pBans]);
INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
INI_WriteInt(File,"VipSkin",PlayerInfo[playerid][pVipSkin]);
INI_WriteInt(File,"MMute",PlayerInfo[playerid][pMMute]);
INI_WriteInt(File,"MStop",PlayerInfo[playerid][pMStop]);
INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]);
INI_WriteInt(File,"Mintues",PlayerInfo[playerid][pMinutes]);
INI_WriteInt(File,"Seconds",PlayerInfo[playerid][pSeconds]);
INI_WriteInt(File,"SpeedSet",PlayerInfo[playerid][pSpeedSet]);
INI_Close(File);
}
pawn Код:
public OnGameModeExit()
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i))
{
SavePinfo(i);
}
}
//rest of your code
//or
return 1;
}