View Single Post
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 12-17-2016 , 10:39   Re: Plugin Invalid client index 0 pls help :(
Reply With Quote #8

Quote:
Originally Posted by xines View Post
Quote:
Originally Posted by Peace-Maker View Post
Never pass a client index through an asynchronous callback. Use the userid instead.
Explain to me why wiki tells me something different when using handles:
https://wiki.alliedmods.net/Timers_(...#Simple_Values
If you read the wiki example carefully you shall see it uses.

Code:
public void OnClientPutInServer(int client) public void OnClientDisconnect(int client)

The timer is created under OnClientPutInServer forward, and destroyed under OnClientDisconnect if the client leaves before, using user id inside the timer callback is useless, since the timer is destroyed when the client leaves the server (so the userid becomes invalid).

Then it shows that you can use client serial OR UserID.
And you should notice the timer is no longer destroyed under OnClientDisconnect forward.
Because under the timer callback we look if the client serial OR UserID is still valid (aka the client didn't leave), and display or not the welcome message.
__________________

Last edited by Benoist3012; 12-17-2016 at 10:40.
Benoist3012 is offline