PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <hamsandwich>
#define PLUGIN "Alive Player"
#define VERSION "1.0"
#define AUTHOR "vato loco [GE-S]"
#define TASK_GETPLAYER 37852
#define SetBits(%1,%2) %1 |= 1<<(%2 & 31)
#define ClearBits(%1,%2) %1 &= ~(1<<(%2 & 31))
#define GetBits(%1,%2) %1 & 1<<(%2 & 31)
new g_bitAlive
new g_SyncTeam1
new g_SyncTeam2
new g_iMaxPlayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1)
g_SyncTeam1 = CreateHudSyncObj()
g_SyncTeam2 = CreateHudSyncObj()
g_iMaxPlayers = get_maxplayers()
set_task(0.5, "GetPlayer", TASK_GETPLAYER, _, _, "b")
}
public client_putinserver(id)
{
ClearBits(g_bitAlive, id)
}
public client_disconnected(id)
{
ClearBits(g_bitAlive, id)
}
public fw_PlayerSpawn(id)
{
if(is_user_alive(id))
{
SetBits(g_bitAlive, id)
}
}
public fw_PlayerKilled(id)
{
ClearBits(g_bitAlive, id)
}
public GetPlayer()
{
static id, iTeam
new iPlayerTrroNum, iPlayerCtNum
for(id = 1; id <= g_iMaxPlayers; id++)
{
if(GetBits(g_bitAlive, id))
{
iTeam = get_user_team(id)
switch(iTeam)
{
case 1: ++iPlayerTrroNum
case 2: ++iPlayerCtNum
}
ShowCustomSync(id, g_SyncTeam1, "TE vivos: %d", 255, 0, 0, 0.01, 1, iPlayerTrroNum)
ShowCustomSync(id, g_SyncTeam2, "^nCT vivos: %d", 0, 100, 255, 0.01, 2, iPlayerCtNum)
}
}
}
ShowCustomSync(id, SyncType, Msg[], Red, Green, Blue, Float:xPos, Channel, TeamCount)
{
set_hudmessage(Red, Green, Blue, xPos, 0.14, _, _, 2.0, _, _, Channel)
ShowSyncHudMsg(id, SyncType, Msg, TeamCount)
}
Hello 12 years later

The code wrote by
ConnorMcLeod is not working properly for me.
I have edited line 75 so the plugin shows 2 separated messages, 1 on each line.
But the plugin is not counting players as it should.
Example:
We are 20 on server, 10 vs 10.
Plugin shows 8 vs 7.
Some times we are 9 vs 8.
The plugin shows 5 vs 5.
Or like the image below:
Or any other amounts.
What can it be?
I compiled it using the latest amx 10.
I use rehlds, regame, amx10 and metamod-r.
Thank you.