ServerInfo Saving... YSI/y_ini
#1

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?
Reply
#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
#3

+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
Reply
#4

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;
}
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)