diff --git a/RadarSpotAll/scripting/RadarSpotAll.sp b/RadarSpotAll/scripting/RadarSpotAll.sp index ed1c2bc2..f3ed6142 100644 --- a/RadarSpotAll/scripting/RadarSpotAll.sp +++ b/RadarSpotAll/scripting/RadarSpotAll.sp @@ -1,6 +1,6 @@ #include #include -#include +#include #pragma semicolon 1 #pragma newdecls required @@ -14,15 +14,26 @@ public Plugin myinfo = url = "" }; -public void OnClientPutInServer(int client) +int g_hPlayerSpotted; +int g_aSpottedPlayers[MAXPLAYERS+1] = {1, ...}; + +public void OnPluginStart() { - SDKHook(client, SDKHook_PostThink, OnPostThink); + g_hPlayerSpotted = FindSendPropInfo("CCSPlayerResource", "m_bPlayerSpotted"); + if(g_hPlayerSpotted == -1) + SetFailState("Couldn't find CCSPlayerResource::m_bPlayerSpotted"); } -public void OnPostThink(int client) +public void OnMapStart() { - if(ZR_IsClientZombie(client)) - { - SetEntProp(client, Prop_Send, "m_bSpotted", 1); - } + int entity = FindEntityByClassname(MaxClients+1, "cs_player_manager"); + if(entity == -1) + SetFailState("Unable to find cs_player_manager entity"); + + SDKHook(entity, SDKHook_ThinkPost, OnThinkPost); +} + +public void OnThinkPost(int entity) +{ + SetEntDataArray(entity, g_hPlayerSpotted, g_aSpottedPlayers, MAXPLAYERS+1, 1, true); }