PlayerRankings: Fix error spam galore.

Seems IsValidEntity doesnt work on non CBaseEntity?? Usefull stuff here.
This commit is contained in:
zaCade 2019-07-18 18:12:26 +02:00
parent 30cb7ee3b2
commit 2559804e00

View File

@ -665,6 +665,9 @@ void SpawnCrown(int client)
SetVariantString("!activator"); SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", client); AcceptEntityInput(entity, "SetParent", client);
if (g_bEngineCSGO)
return;
DataPack data = new DataPack(); DataPack data = new DataPack();
data.WriteCell(EntIndexToEntRef(entity)); data.WriteCell(EntIndexToEntRef(entity));
data.WriteCell(EntIndexToEntRef(client)); data.WriteCell(EntIndexToEntRef(client));
@ -712,6 +715,9 @@ void SpawnSkull(int client)
SetVariantString("!activator"); SetVariantString("!activator");
AcceptEntityInput(entity, "SetParent", client); AcceptEntityInput(entity, "SetParent", client);
if (g_bEngineCSGO)
return;
DataPack data = new DataPack(); DataPack data = new DataPack();
data.WriteCell(EntIndexToEntRef(entity)); data.WriteCell(EntIndexToEntRef(entity));
data.WriteCell(EntIndexToEntRef(client)); data.WriteCell(EntIndexToEntRef(client));
@ -725,10 +731,16 @@ void SpawnSkull(int client)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action OnCrownUpdate(Handle timer, DataPack data) public Action OnCrownUpdate(Handle timer, DataPack data)
{ {
int entity = EntRefToEntIndex(data.ReadCell());
int client = EntRefToEntIndex(data.ReadCell());
data.Reset(); 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)) if (!IsValidEntity(entity) || !IsClientInGame(client) || !IsPlayerAlive(client))
{ {
AcceptEntityInput(entity, "Kill"); AcceptEntityInput(entity, "Kill");
@ -752,10 +764,16 @@ public Action OnCrownUpdate(Handle timer, DataPack data)
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action OnSkullUpdate(Handle timer, DataPack data) public Action OnSkullUpdate(Handle timer, DataPack data)
{ {
int entity = EntRefToEntIndex(data.ReadCell());
int client = EntRefToEntIndex(data.ReadCell());
data.Reset(); 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)) if (!IsValidEntity(entity) || !IsClientInGame(client) || !IsPlayerAlive(client))
{ {
AcceptEntityInput(entity, "Kill"); AcceptEntityInput(entity, "Kill");