Yes, i'm using env_instructor_hint at the moment, but I want to parent it to the player and make it follow them as they move around the screen. I'm not sure how to do that. Here is my current code that displays text when aiming at a player on the opposite team:
Code:
#include <sourcemod>
#include <sdktools>
new Handle:hTimer[MAXPLAYERS+1] = INVALID_HANDLE;
public OnClientPostAdminCheck(client)
{
if(hTimer[client] == INVALID_HANDLE) hTimer[client] = CreateTimer(1.0, Timer, client, TIMER_REPEAT);
}
public OnClientDisconnect(client)
{
if (hTimer[client] != INVALID_HANDLE)
{
KillTimer(hTimer[client]);
hTimer[client] = INVALID_HANDLE;
}
}
public Action:Timer(Handle:timer, any:client)
{
if (IsClientInGame(client) && !IsFakeClient(client))
{
new target = GetClientAimTarget(client, true);
if(target < 1 || target > MaxClients || target == client) return Plugin_Continue;
if(IsClientInGame(target) && IsPlayerAlive(target))
{
new client_team = GetClientTeam(client);
new target_team = GetClientTeam(target);
if (client_team != target_team)
{
char targetname[64];
Format(targetname, 64, "%N", target);
int entity = CreateEntityByName("env_instructor_hint");
char sInstructorHintTarget[64];
Format(sInstructorHintTarget, sizeof(sInstructorHintTarget), "hint%d", target);
DispatchKeyValue(client, "targetname", sInstructorHintTarget);
DispatchKeyValue(entity, "hint_target", sInstructorHintTarget);
DispatchKeyValue(entity, "hint_timeout", "15");
DispatchKeyValue(entity, "hint_static", "1");
DispatchKeyValue(entity, "hint_forcecaption", "1");
DispatchKeyValue(entity, "hint_caption", targetname);
DispatchKeyValue(entity, "hint_icon_onscreen", "icon_skull");
DispatchKeyValue(entity, "hint_icon_offset", "50.0")
DispatchKeyValue(entity, "hint_pulseoption", "0");
DispatchKeyValue(entity, "hint_color", "30 255 30");
DispatchSpawn(entity);
AcceptEntityInput(entity, "ShowHint", client);
SetVariantString("OnUser1 !self:Kill::6:1");
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
}
}
}