From bab8f2c167f9e425fb225074b65d4bc1b234c917 Mon Sep 17 00:00:00 2001 From: Nairda <38843773+Nairdaa@users.noreply.github.com> Date: Sun, 17 Jan 2021 22:16:30 +0100 Subject: [PATCH] client index fix --- scripting/shavit-firstjumptick.sp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripting/shavit-firstjumptick.sp b/scripting/shavit-firstjumptick.sp index 9a7d031..96080db 100644 --- a/scripting/shavit-firstjumptick.sp +++ b/scripting/shavit-firstjumptick.sp @@ -120,7 +120,7 @@ int GetHUDTarget(int client) { int iTarget = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget"); - if(!IsFakeClient(iTarget)) + if(!IsValidClientIndex(iTarget)) { target = iTarget; } @@ -152,3 +152,9 @@ stock void SetCookie(int client, Handle hCookie, int n) IntToString(n, sCookie, sizeof(sCookie)); SetClientCookie(client, hCookie, sCookie); } + +// We don't want the -1 client id bug. Thank Volvo™ for this +stock bool IsValidClientIndex(int client) +{ + return (0 < client <= MaxClients); +}