[HELP] Saving IP with dini <> Help!! D: bump bump
#1

Hey,
im making an auto login, and i need to save ip's
when i use dini_IntSet my ip is 15
when i use dini_FloatSet my ip is 15.000000
when i use dini_Set my ip is 255.255.255.255 (in my test server and in my FSCK server (for every1))
tmp3 is getplayerip balblabla and i use tmp3 to put in dini,
but in printf, it is the right ip,

what do i need to do?

if u need more info, just ask, i hope its clear. :\
Reply
#2

Код:
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"Ip",tmp3);
Treat tmp3 as a string and not a integer variable.
Reply
#3

Quote:
Originally Posted by DJDhan
Код:
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"Ip",tmp3);
Treat tmp3 as a string and not a integer variable.
i already use dini_Set, but then my ip is 255.255.255.255 in my user file,
but i also made a printf with also tmp3, and i see in my console, my normal ip, (same tmp3 i use for files)
Reply
#4

You are saving the IP under OnPlayerDisconnect. When you put it their, the output of the IP will always be the 255.255.255.255. You must put the code somewhere else.
Reply
#5

That's weird. Do you have it under OnPlayerConect or OnPlayerDisconnect?
Reply
#6

ehum...

xD..
i got it under onplayerdisconnect xD

EDIT:
alright, now i have to compare them with each other, and if they are the same, he logs in,
but i use
dini_Get(file,"Ip"); and its blank
not a number but nothing :S
Reply
#7

I dont recommend what you are doing because a lot of peoples ip's change dynamically. But do this:

pawn Код:
public OnPlayerConnect(playerid)
{
new ip[64],newip[64];
ip = dini_Get(file, "Ip");
GetPlayerIp(playerid, ip, sizeof(ip)); //function params i forgot xD might have to correct this
if(strcmp(ip, newip, true) == 0)
{
LoginPlayer..
}
else
{
Kick(playerid); // ip doesnt match in file
}
return 1;
}
Reply
#8

ok thx,

gonna try tomorrow, im on my psp now xD
Reply
#9

IP's asked for at OnPlayerDisconnect always return 255.255.255.255. You might wish to save their IP to a global string to recover it when the player disconnects.
Reply
#10

i now got it on /login, and it saves good.
i hope dini_Get works to load the ip.
gonna test when im on my pc
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)