SA-MP Forums Archive
ServerInfo Saving... YSI/y_ini - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ServerInfo Saving... YSI/y_ini (/showthread.php?tid=543056)



ServerInfo Saving... YSI/y_ini - danish007 - 24.10.2014

Is It Possible To Save Server Info..

like

Serverkicks = X
ServerBans = X

using YSI/Y_ini?

some thing like ServerInfo[ServerKicks]++; how can i make it and save it?


Re: ServerInfo Saving... YSI/y_ini - Rudy_ - 24.10.2014

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


Re: ServerInfo Saving... YSI/y_ini - gurmani11 - 24.10.2014

+Rudy_ // Well done but i think he wanna write the Server based data not player based Eg. "Logs"
if yes if he wants it >> here is the link Thanx to +Face9000 Click HERE


Re: ServerInfo Saving... YSI/y_ini - Rudy_ - 24.10.2014

To know how much times a player is kicked
pawn Код:
CMD:mykicks(playerid, params[])
{
    new msg[128];
    new kickedtime = PlayerInfo[playerid][pKicks];
    format(msg, sizeof(msg), "You have been kicked %i times", kickedtime);
    SendClientMessage(playerid, -1, msg); // -1 is white
    return 1;
}



Re: ServerInfo Saving... YSI/y_ini - danish007 - 24.10.2014

i need help in server data saving... not players.....