Need help to register the IP of players -
Amine_Mejrhirrou - 05.04.2012
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;
}
Re: Need help to register the IP of players -
ViniBorn - 05.04.2012
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;
}
Re: Need help to register the IP of players -
TzAkS. - 05.04.2012
The ip is like this
15
.16
.
And the
. is string..
Re : Need help to register the IP of players -
Amine_Mejrhirrou - 05.04.2012
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
Re: Need help to register the IP of players -
ViniBorn - 05.04.2012
This is wrong
pawn Код:
format(str, 16, "%s", GetPlayerIp(playerid, ip, sizeof(ip)));
http://forum.sa-mp.com/showpost.php?...41&postcount=2
Re : Need help to register the IP of players -
Amine_Mejrhirrou - 05.04.2012
thnks for helping, i finally succeed it ! thanks again