how many players on which team can I print to chat?
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <retakes>
#include <cstrike>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_AUTHOR "Czar, B3none"
#define PLUGIN_VERSION "1.4"
Handle cvar_showterrorists = INVALID_HANDLE;
public Plugin myinfo =
{
name = "Retake hud",
author = PLUGIN_AUTHOR,
description = "Bombsite Hud",
version = PLUGIN_VERSION,
url = "https://github.com/Czar-VG/RetakeSiteHud"
};
public void OnPluginStart()
{
cvar_showterrorists = CreateConVar("sm_showterrorists", "1");
AutoExecConfig(true, "retakehud");
HookEvent("round_start", Event_OnRoundStart);
}
public void Event_OnRoundStart(Handle event, const char[] name, bool dontBroadcast)
{
CreateTimer(1.0, displayHud);
}
public Action displayHud(Handle timer)
{
if (IsWarmup())
{
return;
}
char bombsite[8];
bombsite = (Retakes_GetCurrrentBombsite() == BombsiteA) ? "A" : "B";
bool showTerrorists = GetConVarBool(cvar_showterrorists);
for (int i = 1; i <= MaxClients; i++)
{
int clientTeam = GetClientTeam(i);
if (IsValidClient(i))
{
if (HasBomb(i))
{
// We always want to show this one regardless
ShowHudText(i, 5, "Bomba Kuruldu!");
}
else if (clientTeam == CS_TEAM_CT || (clientTeam == CS_TEAM_T && showTerrorists))
{
PrintCenterText(i, "<font color='#008000'%s Bombsite: ----- %s ----- \n %d T vs %d CT</font>") clientTeam == CS_TEAM_T ? "Defend" : "Retake", bombsite, ???, ???);
}
}
}
}
stock bool IsValidClient(int client)
{
return client > 0
&& client <= MaxClients
&& IsClientConnected(client)
&& IsClientInGame(client)
&& !IsFakeClient(client);
}
stock bool HasBomb(int client)
{
return GetPlayerWeaponSlot(client, 4) != -1;
}
stock bool IsWarmup()
{
return GameRules_GetProp("m_bWarmupPeriod") == 1;
}
__________________