Thread: CSS BRush
View Single Post
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 01-07-2013 , 16:00   Re: CSS BRush
Reply With Quote #90

Quote:
Originally Posted by TnTSCS View Post
okay... but just so I know for sure:

L505 has
PHP Code:
ClientTimer[client] = CreateTimer(0.1Timer_HandleTeamSwitchclient); 
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
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 01-07-2013 at 16:25.
RedSword is offline