From 7f2d4c01df709f760a8604a0efa9e98cc86877ed Mon Sep 17 00:00:00 2001 From: zaCade Date: Thu, 25 Jul 2019 09:31:52 +0200 Subject: [PATCH] PlayerRankings: Fix a slight error and oversight. --- PlayerRankings/scripting/PlayerRankings.sp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/PlayerRankings/scripting/PlayerRankings.sp b/PlayerRankings/scripting/PlayerRankings.sp index 4612a4ac..dbe1ff0d 100644 --- a/PlayerRankings/scripting/PlayerRankings.sp +++ b/PlayerRankings/scripting/PlayerRankings.sp @@ -602,8 +602,8 @@ public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast //---------------------------------------------------------------------------------------------------- public Action OnClientSpawnPostCrown(Handle timer, int serial) { - int client = -1; - if((client = GetClientFromSerial(serial)) == -1) + int client; + if((client = GetClientFromSerial(serial)) == 0) return; if (!IsClientInGame(client) || !IsPlayerAlive(client)) @@ -617,8 +617,8 @@ public Action OnClientSpawnPostCrown(Handle timer, int serial) //---------------------------------------------------------------------------------------------------- public Action OnClientSpawnPostSkull(Handle timer, int serial) { - int client = -1; - if((client = GetClientFromSerial(serial)) == -1) + int client; + if((client = GetClientFromSerial(serial)) == 0) return; if (!IsClientInGame(client) || !IsPlayerAlive(client)) @@ -736,7 +736,10 @@ public Action OnCrownUpdate(Handle timer, DataPack data) if ((client = EntRefToEntIndex(data.ReadCell())) == INVALID_ENT_REFERENCE) return Plugin_Stop; - if (!IsValidEntity(entity) || !IsClientInGame(client) || !IsPlayerAlive(client)) + if (!IsValidEntity(entity)) + return Plugin_Stop; + + if (!IsClientInGame(client) || !IsPlayerAlive(client)) { AcceptEntityInput(entity, "Kill"); return Plugin_Stop; @@ -766,7 +769,10 @@ public Action OnSkullUpdate(Handle timer, DataPack data) if ((client = EntRefToEntIndex(data.ReadCell())) == INVALID_ENT_REFERENCE) return Plugin_Stop; - if (!IsValidEntity(entity) || !IsClientInGame(client) || !IsPlayerAlive(client)) + if (!IsValidEntity(entity)) + return Plugin_Stop; + + if (!IsClientInGame(client) || !IsPlayerAlive(client)) { AcceptEntityInput(entity, "Kill"); return Plugin_Stop;