Re: [Help] hud message for spectator
Quote:
Originally Posted by NanoC
(Post 2651813)
PHP Code:
#include <sourcemod>
#include <cstrike>
public Plugin myinfo =
{
name = "HUD",
author = "Nevvy",
description = "",
version = "",
url = "Nevvy.pl"
};
public OnPluginStart()
{
CreateTimer(5.0, HUD, _, TIMER_REPEAT);
}
public Action HUD(Handle timer)
{
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && GetClientTeam(i) == 1)
{
SetHudTextParams(-1.0, 0.1, 5.0, 0, 255, 255, 255, 0, 0.1, 0.1, 0.1);
ShowHudText(i, 5, "• YOUR MESSAGE •");
}
}
}
|
Quote:
I wanted the hud message to be displayed only to players who are on spectator team.
And, if possible, display only when teams are full (5vs5).
|
PHP Code:
#include <sourcemod>
#include <cstrike>
public Plugin myinfo =
{
name = "HUD",
author = "Nevvy",
description = "",
version = "",
url = "Nevvy.pl"
};
public OnPluginStart()
{
CreateTimer(5.0, HUD, _, TIMER_REPEAT);
}
public Action HUD(Handle timer)
{
int ctcount = GetClientsCountTeam(3);
int tcount = GetClientsCountTeam(2);
if(ctcount == 5 && tcount == 5)
{
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && GetClientTeam(i) == 1)
{
SetHudTextParams(-1.0, 0.1, 5.0, 0, 255, 255, 255, 0, 0.1, 0.1, 0.1);
ShowHudText(i, 5, "• YOUR MESSAGE •");
}
}
}
}
stock int GetClientsCountTeam(int team)
{
int j = 0;
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && GetClientTeam(i) == team && !IsFakeClient(i))
{
j++;
}
}
return j;
}
|