RadarSpotAll: Make it actually work on cstrike xd

This commit is contained in:
BotoX 2019-10-21 00:16:02 +02:00
parent 7fdf8dce34
commit ef0534347d

View File

@ -1,6 +1,6 @@
#include <sourcemod> #include <sourcemod>
#include <sdkhooks> #include <sdkhooks>
#include <zombiereloaded> #include <sdktools>
#pragma semicolon 1 #pragma semicolon 1
#pragma newdecls required #pragma newdecls required
@ -14,15 +14,26 @@ public Plugin myinfo =
url = "" 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)) int entity = FindEntityByClassname(MaxClients+1, "cs_player_manager");
{ if(entity == -1)
SetEntProp(client, Prop_Send, "m_bSpotted", 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);
} }