From 7bb5bb3042fa59d419aaff66bb4e149ce34f5b49 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Sat, 29 Dec 2018 23:25:52 -0800 Subject: [PATCH] Fix basecomm throwing errors on console native invocation... --- plugins/basecomm/natives.sp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/basecomm/natives.sp b/plugins/basecomm/natives.sp index afbe1d1c9..e7f4a1c06 100644 --- a/plugins/basecomm/natives.sp +++ b/plugins/basecomm/natives.sp @@ -34,12 +34,12 @@ public int Native_IsClientGagged(Handle hPlugin, int numParams) { int client = GetNativeCell(1); - if (client < 1 || client > MaxClients) + if (!(-1 < client <= MaxClients)) { return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client); } - if (!IsClientInGame(client)) + if (client && !IsClientInGame(client)) { return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client); } @@ -50,12 +50,12 @@ public int Native_IsClientMuted(Handle hPlugin, int numParams) { int client = GetNativeCell(1); - if (client < 1 || client > MaxClients) + if (!(-1 < client <= MaxClients)) { return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client); } - if (!IsClientInGame(client)) + if (client && !IsClientInGame(client)) { return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client); } @@ -66,12 +66,12 @@ public int Native_IsClientMuted(Handle hPlugin, int numParams) public int Native_SetClientGag(Handle hPlugin, int numParams) { int client = GetNativeCell(1); - if (client < 1 || client > MaxClients) + if (!(-1 < client <= MaxClients)) { return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client); } - if (!IsClientInGame(client)) + if (client && !IsClientInGame(client)) { return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client); } @@ -103,12 +103,12 @@ public int Native_SetClientGag(Handle hPlugin, int numParams) public int Native_SetClientMute(Handle hPlugin, int numParams) { int client = GetNativeCell(1); - if (client < 1 || client > MaxClients) + if (!(-1 < client <= MaxClients)) { return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index %d", client); } - if (!IsClientInGame(client)) + if (client && !IsClientInGame(client)) { return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client); }