Wow, thanks for the response.
I suppose there's no point keeping this secret because its for the Community anyway
I tried what you suggested but got error:
(30) : error 034: argument does not have a default value (argument 3)
This is the full code so please pick at it and let me know where I went wrong.
Also, if you could show me how I would make it kill the menu when the tank dies that would be fantastic!
PHP Code:
#include <sourcemod>
#include <sdktools>
#define L4D_MAXCLIENTS_PLUS1 (MaxClients+1)
new Handle:menuPanel = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "CyberGamer Spectator HUD",
author = "ZeeBOB",
description = "Adds a HUD to spectators to easily see the infected's status",
version = "1.2",
url = ""
}
public OnPluginStart()
{
HookEvent("tank_spawn", Event_TankSpawn);
}
public Action:showHUD(Handle:timer)
{
DrawHUD();
}
public Action:Event_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
CreateDataTimer(1.0, showHUD, _, TIMER_REPEAT);
}
DrawHUD()
{
decl String:sTempString[1024];
decl String:name[MAX_NAME_LENGTH];
new Handle:specHUD = CreatePanel();
new i;
for (i=1;i<L4D_MAXCLIENTS_PLUS1;i++)
{
if (IsClientInGame(i) && GetClientTeam(i) == 3 && GetEntProp(i, Prop_Send, "m_zombieClass") == 5)
{
GetClientName(i, name, sizeof(name));
if (strlen(name) > 25)
{
name[22] = '.';
name[23] = '.';
name[24] = '.';
name[25] = 0;
}
Format(sTempString, 1024, "%s", name);
DrawPanelText(specHUD, sTempString);
if (IsPlayerAlive(i))
{
Format(sTempString, sizeof(sTempString), "-> %dHP", GetClientHealth(i));
}
else
{
sTempString = "-> Dead";
}
DrawPanelText(specHUD, sTempString);
if(!IsFakeClient(i))
{
Format(sTempString, sizeof(sTempString), "Tank Control: %d%", 100-GetEntProp(i, Prop_Send, "m_frustration"));
}
else
{
sTempString = "-> AI Control!";
}
DrawPanelText(specHUD, sTempString);
}
}
for (i=1;i<L4D_MAXCLIENTS_PLUS1;i++)
{
if(IsClientInGame(i))
{
SendPanelToClient(specHUD, i, Menu_HUDPanel, 1);
}
}
if(menuPanel != INVALID_HANDLE)
{
CloseHandle(menuPanel);
}
menuPanel = specHUD;
}
public Menu_HUDPanel(Handle:menu, MenuAction:action, param1, param2)
{
}