Need help to register the IP of players
#1

hello Scripters.
i didn't script for a long time and i'm not a very good at scripting that's why i need help
i would like to add the IP of the players last connection in their account file
for now I've tried something but it didn't work
this is what i have in the file
Team=1
Password=XXXXXXXXXXXXXXXXXX
AdminLevel=5
Cash=15800
VIP=0
Skin=285
IP=15
(by the way my ip don't have the number 15 )
and this is the script
Код:
public OnPlayerDisconnect(playerid, reason)
{
	new file[128], ip[16];
	format(file, 128, USER_FILE, GetPName(playerid));
	if(fexist(file)) {
		if(logedin[playerid] == 0)
		{
			dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
			dini_IntSet(file, "IP", GetPlayerIp(playerid, ip, sizeof(ip)));
		}
	}
	return 1;
}
Reply
#2

IP is a string, use dini_Set

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new file[64], ip[16];
    format(file, 64, USER_FILE, GetPName(playerid));
    if(fexist(file))
    {
        if(logedin[playerid] == 0)
        {
            GetPlayerIp(playerid, ip, sizeof(ip));
            dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
            dini_Set(file, "IP", ip);
        }
    }
    return 1;
}
Reply
#3

The ip is like this
15.16.
And the . is string..
Reply
#4

I've tryed this but still don't work
CODE

Код:
public OnPlayerDisconnect(playerid, reason)
{
	new file[128],str[30], ip[16];
	format(file, 128, USER_FILE, GetPName(playerid));
	format(str, 16, "%s", GetPlayerIp(playerid, ip, sizeof(ip)));
	if(fexist(file)) {
		if(logedin[playerid] == 0)
		{
			dini_IntSet(file, "Cassh", GetPlayerMoney(playerid));
			dini_Set(file,"IP", str);
		}
	}
	return 1;
}
File

Team=1
Password=XXXXXXXXXXXXXX
AdminLevel=
Cassh=15700
Skin=285
IP=mine_Mejrhirro
Reply
#5

This is wrong
pawn Код:
format(str, 16, "%s", GetPlayerIp(playerid, ip, sizeof(ip)));
http://forum.sa-mp.com/showpost.php?...41&postcount=2
Reply
#6

thnks for helping, i finally succeed it ! thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)