View Single Post
dustinandband
Senior Member
Join Date: May 2015
Old 07-30-2021 , 10:06   Re: [L4D2]Exception reported: Client index 0 is invalid
Reply With Quote #6

Quote:
Originally Posted by Crasher_3637 View Post
Below this line:
PHP Code:
new attacker GetClientOfUserId(GetEventInt(event"attacker")); 
You can add:
PHP Code:
if (!(attacker <= MaxClients && IsClientInGame(attacker))) // check that attacker index is between 1 and 32 and is in-game
    
return Plugin_Continue
Had anyone seen a client index above the MacClients value? Just asking here cause I never check if a client index is below 32 and haven’t had any errors about that over the years, but wondering why it’s a common practice to check.
dustinandband is offline