Kick already disconnected player
#1

Hi,

Can be issue if player out from server onplayerdisconnect callback get called and i at same moment call kick, it's possible that 2 onplayerdisconnect can call?
Reply
#2

I've seen 2 admins banned one person but the thing you mentioned is unlikely to be happen
Reply
#3

Quote:
Originally Posted by Matz
View Post
I've seen 2 admins banned one person but the thing you mentioned is unlikely to be happen
That's primarily because of the delay between the ban and kick functions. A lot of servers delay the kick process by around a second or two to enable for a ban message to be sent to the player being banned. What I assume happened in your case is that two admins banned an individual in the same instant or in the aforementioned time frame.

As for the question, OnPlayerDisconnect is called once, when the player actually disconnects.
Reply
#4

Another question is this callback OnPlayerDisconnect always call when player disconnect can by times that it's not by called lagg or smth? because if i'am saving player stats it's get bad if one time it's not save.
Reply
#5

It's always called when the player disconnects unless your server crashes.
What I would suggest is creating a timer that regularly saves your players accounts, this will reduce the likeliness of a significant rollback should a Player disconnect and not have their stats save.
Reply
#6

Quote:
Originally Posted by XVlaDX
View Post
That's primarily because of the delay between the ban and kick functions. A lot of servers delay the kick process by around a second or two to enable for a ban message to be sent to the player being banned. What I assume happened in your case is that two admins banned an individual in the same instant or in the aforementioned time frame.
You can fix that by assigning a variable (say BeingKicked[playerid] = true) to whoever you set that delayed timer to, and on /ban or /kick commands you just do a check to make sure that BeingKicked variable is set to false before executing anything.
Reply
#7

OnPlayerDisconnect will never call twice, no matter what you do.
The only thing that might make it not call is accessing invalid array slots (or similar "bugs"), which can lead to weird and unpredicted behaviour, but that would be your fault/a script-related bug.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)