From 2559804e00703e958aea6b3e83464819294c9dde Mon Sep 17 00:00:00 2001 From: zaCade Date: Thu, 18 Jul 2019 18:12:26 +0200 Subject: [PATCH] PlayerRankings: Fix error spam galore. Seems IsValidEntity doesnt work on non CBaseEntity?? Usefull stuff here. --- PlayerRankings/scripting/PlayerRankings.sp | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/PlayerRankings/scripting/PlayerRankings.sp b/PlayerRankings/scripting/PlayerRankings.sp index 95df04cd..03250659 100644 --- a/PlayerRankings/scripting/PlayerRankings.sp +++ b/PlayerRankings/scripting/PlayerRankings.sp @@ -665,6 +665,9 @@ void SpawnCrown(int client) SetVariantString("!activator"); AcceptEntityInput(entity, "SetParent", client); + if (g_bEngineCSGO) + return; + DataPack data = new DataPack(); data.WriteCell(EntIndexToEntRef(entity)); data.WriteCell(EntIndexToEntRef(client)); @@ -712,6 +715,9 @@ void SpawnSkull(int client) SetVariantString("!activator"); AcceptEntityInput(entity, "SetParent", client); + if (g_bEngineCSGO) + return; + DataPack data = new DataPack(); data.WriteCell(EntIndexToEntRef(entity)); data.WriteCell(EntIndexToEntRef(client)); @@ -725,10 +731,16 @@ void SpawnSkull(int client) //---------------------------------------------------------------------------------------------------- public Action OnCrownUpdate(Handle timer, DataPack data) { - int entity = EntRefToEntIndex(data.ReadCell()); - int client = EntRefToEntIndex(data.ReadCell()); data.Reset(); + int entity = INVALID_ENT_REFERENCE; + if ((entity = EntRefToEntIndex(data.ReadCell())) == INVALID_ENT_REFERENCE) + return Plugin_Stop; + + int client = INVALID_ENT_REFERENCE; + if ((client = EntRefToEntIndex(data.ReadCell())) == INVALID_ENT_REFERENCE) + return Plugin_Stop; + if (!IsValidEntity(entity) || !IsClientInGame(client) || !IsPlayerAlive(client)) { AcceptEntityInput(entity, "Kill"); @@ -752,10 +764,16 @@ public Action OnCrownUpdate(Handle timer, DataPack data) //---------------------------------------------------------------------------------------------------- public Action OnSkullUpdate(Handle timer, DataPack data) { - int entity = EntRefToEntIndex(data.ReadCell()); - int client = EntRefToEntIndex(data.ReadCell()); data.Reset(); + int entity = INVALID_ENT_REFERENCE; + if ((entity = EntRefToEntIndex(data.ReadCell())) == INVALID_ENT_REFERENCE) + return Plugin_Stop; + + int client = INVALID_ENT_REFERENCE; + if ((client = EntRefToEntIndex(data.ReadCell())) == INVALID_ENT_REFERENCE) + return Plugin_Stop; + if (!IsValidEntity(entity) || !IsClientInGame(client) || !IsPlayerAlive(client)) { AcceptEntityInput(entity, "Kill");