SA-MP Forums Archive
IP Not saving - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: IP Not saving (/showthread.php?tid=417269)



IP Not saving - Infinity90 - 20.02.2013

Well, the IP is not saving, it's saving as 255.255.255.255 - It's strange, I'am using the same function as /getip and that works fine.
pawn Код:
new playerip[16];
    GetPlayerIp(playerid, playerip, sizeof(playerip));
    pInfo[playerid][pIP] = playerip;
I've tried lots of different solutions.


Re: IP Not saving - ryansheilds - 20.02.2013

Hmm try:
pawn Код:
GetPlayerIp(playerid, pInfo[playerid][pIP], 16);
Also try storing the IP when the player connects, I think it bugs if you try to fetch the IP on player disconnect.


Re: IP Not saving - Scenario - 20.02.2013

I'm surprised this didn't give you an error...

pawn Код:
pInfo[playerid][pIP] = playerip;
Use strcpy to do that- it's probably what's causing this problem.

pawn Код:
#define strcpy(%0,%1) \
    strcat((%0[0] = '\0', %0), %1)
Personally, I just call GetPlayerIp() under OnPlayerConnect and store it into a PVar. It's not like their IP is going to change while they're connected to the server.


Re: IP Not saving - Infinity90 - 20.02.2013

I changed it to OnPlayerConnect works now. Cheers


Re: IP Not saving - CreativityLacker - 20.02.2013

If you put it under OnPlayerDisconnect, it's ob...vious it wouldn't work

http://forum.sa-mp.com/archive/index.php/t-214923.html


Re: IP Not saving - Vince - 20.02.2013

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I'm surprised this didn't give you an error...

pawn Код:
pInfo[playerid][pIP] = playerip;
Array to array assignments work perfectly fine, provided that the size of the array on the left is equal or bigger than the size of the array on the right.