[IMPORTANT] OnPlayerDisconnect! -
¤Adas¤ - 11.04.2010
Hello. I have noticed strange bug in this callback.
Mostly when player disconnects, it shows this:
Код:
Player name: // It is null!
Player IP: 255.255.255.255 // It is invalid!
Parameters "playerid" and "reason" return very strange values.
What is this? Can you fix it?
Thanks.
Re: [IMPORTANT] OnPlayerDisconnect! -
dice7 - 11.04.2010
You're trying to get a disconnected players name and ip
Re: [IMPORTANT] OnPlayerDisconnect! -
¤Adas¤ - 11.04.2010
Quote:
Originally Posted by dice7
You're trying to get a disconnected players name and ip
|
Yes, but sometimes it works. And I think, in prev. versions it worked OK. strange
Re: [IMPORTANT] OnPlayerDisconnect! -
Carlton - 11.04.2010
It's not a bug, OnPlayerDisconnect just doesn't have enough time to store data. You cannot fix it but you can bypass it. Here's a example.
pawn Код:
new
IP[16],
name[MAX_PLAYER_NAME],
format[128];
public OnPlayerConnect(playerid) {
GetPlayerIP(playerid, IP, 16); GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return 1;
}
public OnPlayerDisconnect(playerid) {
format(format, 128, "%s's left IP was: %s", name, IP);
SendClientMessageToAll(COLOR_WHATEVER, format);
return 1;
}
It will show their name and IP with no problems, like what you said, sometimes it works sometimes it doesn't but this is the best way to make sure it shows the IP and name all the time.
Re: [IMPORTANT] OnPlayerDisconnect! - [03]Garsino - 11.04.2010
The name part works for me..
Re: [IMPORTANT] OnPlayerDisconnect! -
¤Adas¤ - 11.04.2010
Guys. I am not stupid.

I was only reporting this. But thanks anyway.
Re: [IMPORTANT] OnPlayerDisconnect! -
Sergei - 11.04.2010
It should still tell us name and ip of disconnecting player like it can tell us location, health, armour, etc.
Re: [IMPORTANT] OnPlayerDisconnect! -
¤Adas¤ - 11.04.2010
Quote:
Originally Posted by $€ЯĢ
It should still tell us name and ip of disconnecting player like it can tell us location, health, armour, etc.
|
But sometimes both playerid and reason are invalid numbers... This is the problem.
Re: [IMPORTANT] OnPlayerDisconnect! -
dice7 - 11.04.2010
The only problem I had with this was, when you /q the moment you connect, the reason will be kicked/banned