IP Not saving
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

I changed it to OnPlayerConnect works now. Cheers
Reply
#5

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
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)