[Problem]Y_INI save accounts
#6

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
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);
}
that is my players saving system and saving players settings. then under ongamemodeexit put this
pawn Код:
public OnGameModeExit()
{
    for (new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i))
        {
            SavePinfo(i);
        }
    }
    //rest of your code
    //or
    return 1;
}
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.
Reply


Messages In This Thread
[Problem]Y_INI save accounts - by -[R]hysi- - 19.05.2012, 15:08
Re: [Problem]Y_INI save accounts - by iGetty - 19.05.2012, 15:25
Respuesta: [Problem]Y_INI save accounts - by -[R]hysi- - 19.05.2012, 16:15
Re: [Problem]Y_INI save accounts - by iGetty - 19.05.2012, 16:19
Respuesta: [Problem]Y_INI save accounts - by -[R]hysi- - 19.05.2012, 17:32
Re: [Problem]Y_INI save accounts - by nickdodd25 - 20.05.2012, 01:00
Respuesta: [Problem]Y_INI save accounts - by -[R]hysi- - 20.05.2012, 12:39
Respuesta: [Problem]Y_INI save accounts - by -[R]hysi- - 20.05.2012, 15:48

Forum Jump:


Users browsing this thread: 3 Guest(s)