SA-MP Forums Archive
Recommendation for GetPlayerIp OnPlayerDisconnect? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Recommendation for GetPlayerIp OnPlayerDisconnect? (/showthread.php?tid=148718)



Recommendation for GetPlayerIp OnPlayerDisconnect? - cAMo - 18.05.2010

For connection logging purposes, how would you recommend getting a player's ip address (GetPlayerIp) when they disconnect from the server (OnPlayerDisconnect)?

Right now OnPlayerDisconnect I am forwarding the playerid to a custom function that executes mysql and GetPlayerIp, and it appears that sometimes it can capture it before the player completely disconnects, but many times the player is already disconnected and it returns 255.255.255.255 which is no good.

Ideas?

Would it work 100% if I GetPlayerIp under OnPlayerDisconnect, and then forward the ip address to the function instead of getting it in the function?


Re: Recommendation for GetPlayerIp OnPlayerDisconnect? - Jefff - 18.05.2010

Код:
//top
new IP[16];
//connect
GetPlayerIp(playerid,IP,16);
SetPVarString(playerid,"pIP",IP);

//disconnect
GetPVarString(playerid,"pIP",IP,sizeof(IP));
printf("* Disconnect IP: %s",IP);



Re: Recommendation for GetPlayerIp OnPlayerDisconnect? - cAMo - 18.05.2010

The strange thing is that I forward playerid, and get the player's name in the function and it can capture that but not the ip address before they are gone.


Re: Recommendation for GetPlayerIp OnPlayerDisconnect? - Joe Staff - 18.05.2010

Then get the player's IP under OnPlayerConnect