Recommendation for GetPlayerIp OnPlayerDisconnect?
#1

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

Код:
//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);
Reply
#3

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

Then get the player's IP under OnPlayerConnect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)