View Single Post
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 05-26-2018 , 20:48   Re: [L4D2] Jockey Pounce Damage
Reply With Quote #45

Quote:
Originally Posted by Visual77 View Post
Atleast validate the client index and check if client is in game after you convert the userid to clientindex when you perform actions such as blind, getclientmode, getclientabsorigin etc, printtochat etc.

If you don't, the server may crash or spit out errors like (client is not connected, client is not ingame, client index is invalid). I've seen this habit in later plugins of thinking doing int client = GetClientOfUserId(event.GetInt("userid"));
is all that one needs before setting netprops or doing other things that will require a state of client connected or client in game.
I'm not entirely sure, if GetClientOfUserId checks it or not, but I'm against adding unnecessary checks unless errors happen.

This is not a new habit, as I've just updated the natives and changed the syntax. Whatever checks you see in there are the ones that the original author added in.
__________________
Spirit_12 is offline