Save player IP Y_Ini
#1

Hi all

I need help with saving a player's IP.

The problem is that I don't know anything about saving the IP. So I will be really thankful if you do it for me :/

I am using this Login/Register system: https://sampforum.blast.hk/showthread.php?tid=273088

Thanks in advance
Reply
#2

create a new enum called IP[16],

then under
pawn Код:
onplayerconnect: GetPlayerIp(playerid, PlayerInfo[playerid][IP], 16);
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("IP",PlayerInfo[playerid][IP]);
    return 1;
}
change your loading public to that^^

then under onplayer disconnect:

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,"IP",PlayerInfo[playerid][IP]);
    INI_Close(File);
    return 1;
}
Reply
#3

The only problem is that an IP is stored as a string, not integer. Y_INI confuses me and I've had my problems with it in the past, but use GetPlayerIp, then use INI_WriteString to store it.
Reply
#4

Thanks to both of you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)