Quote:
Originally Posted by TnTSCS
okay... but just so I know for sure:
L505 has
PHP Code:
ClientTimer[client] = CreateTimer(0.1, Timer_HandleTeamSwitch, client);
Then I have
PHP Code:
public OnClientDisconnect(client) { if (IsClientInGame(client)) { ClearTimer(ClientTimer[client]); } }
ClearTimer(&Handle:timer) { if (timer != INVALID_HANDLE) { KillTimer(timer); timer = INVALID_HANDLE; } }
So I thought if the client disconnects before the timer fires, the timer would be cancelled... is that incorrect thinking? Is it the possibility of a frame or two if the client disconnects and the timer still fires?
Just trying to fully understand is all - nothing else... because almost all of my plugin operate in this fashion regarding ClientTimer[client] = CreateTimer passing client along with the timer.
|
My bad, sorry, I might have reviewed too quickly. You're right; if you kill a timer on disconnect you shouldn'T have any problem.
There is like ~2 good ways to handle the situation. Killing the timer is one, and using userId is the other. UserIds are generally prefered, as they can be fired and forgotten; i.e. no need for a global variable). I think your plugin is fine as it is; I'll have to review it (once) again.
I just thought that from the 2nd revision you would correct it using UserIds rather than killing timer; hence my mistake.
Red
__________________