From ef0534347d7433ff98f18ae0c6ef51cb815c4447 Mon Sep 17 00:00:00 2001 From: BotoX Date: Mon, 21 Oct 2019 00:16:02 +0200 Subject: [PATCH] RadarSpotAll: Make it actually work on cstrike xd --- RadarSpotAll/scripting/RadarSpotAll.sp | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) 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); }