From 2346dc4eaca0b04f6d56b9cc98aded80c3f745c6 Mon Sep 17 00:00:00 2001 From: Walliski Date: Sun, 19 Feb 2023 18:39:27 +0200 Subject: [PATCH] Add additional check for valid clients Sometimes IsClientInGame throws the following exception: `Client index 0 is invalid`. This can happen if the client is not found based on the userid, which means "0" will be returned from GetClientOfUserId. 0 is not a valid client though, so IsClientInGame does not like it. --- scripting/kento_rankme.sp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripting/kento_rankme.sp b/scripting/kento_rankme.sp index 67e37f2..847bd5e 100644 --- a/scripting/kento_rankme.sp +++ b/scripting/kento_rankme.sp @@ -645,7 +645,7 @@ public Action Event_RoundMVP(Handle event, const char[] name, bool dontBroadcast return; int client = GetClientOfUserId(GetEventInt(event, "userid")); - if (!IsClientInGame(client)) + if (client < 1 || !IsClientInGame(client)) return; int team = GetClientTeam(client);