ServerInfo Saving... YSI/y_ini
#2

EDIT: Get saving system from here
https://sampforum.blast.hk/showthread.php?tid=273088

Well if you have a path for saving
pawn Код:
#define PATH "/Users/%s.ini"
And some enums
pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
You can add pKicks to it

pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths,
    pKicks
}
new PlayerInfo[MAX_PLAYERS][pInfo];
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Kicks",PlayerInfo[playerid][pKicks]);
    return 1;
}
Save them on OnPLayerDisconnect
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Kicks",PlayerInfo[playerid][pKicks]);
    INI_Close(File);
    return 1;
}
And if you have a kick command
pawn Код:
CMD:kick(playerid, params[])
{
    PlayerInfo[targetid[pKicks]++;
    //Timer for kick
    return 1;
}
This is just to let you know how can you do it :P
Reply


Messages In This Thread
ServerInfo Saving... YSI/y_ini - by danish007 - 24.10.2014, 09:41
Re: ServerInfo Saving... YSI/y_ini - by Rudy_ - 24.10.2014, 09:52
Re: ServerInfo Saving... YSI/y_ini - by gurmani11 - 24.10.2014, 09:59
Re: ServerInfo Saving... YSI/y_ini - by Rudy_ - 24.10.2014, 10:06
Re: ServerInfo Saving... YSI/y_ini - by danish007 - 24.10.2014, 12:14

Forum Jump:


Users browsing this thread: 1 Guest(s)