Quote:
Originally Posted by 101
This will print a hint message when a human aims at a breakable entity (I guess So).
|
I think this would be a better option
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sdktools_functions>
bool bShow;
public void OnMapStart()
{
CreateTimer(1.0, Timer_HP, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
HookEvent("round_start", Event_Round, EventHookMode_PostNoCopy);
HookEvent("round_end", Event_Round, EventHookMode_PostNoCopy);
}
public void Event_Round(Event event, const char[] name, bool dontBroadcast)
{
bShow = name[6] == 's';
}
public Action Timer_HP(Handle timer)
{
if(!bShow)
return Plugin_Continue;
static char cls[16];
for(int i = 1, aim; i <= MaxClients; i++)
if(IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && (aim = GetClientAimTarget(i, false)) > MaxClients
&& GetEntityClassname(aim, cls, sizeof(cls)) && !strncmp(cls, "func_breakable", 14, false))
PrintHintText(i , "Health [ %d / %d ]", GetEntProp(aim, Prop_Data, "m_iHealth"), GetEntProp(aim, Prop_Data, "m_iMaxHealth"));
return Plugin_Continue;
}
__________________