PHP Code:
#include <amxmodx>
#include <amxmisc>
#define MAX_PLAYERS 32
#define VERSION "1.0"
// Players Bool
new bool:g_bAlive[MAX_PLAYERS+1];
// Global Variables
new g_iMaxPlayers;
// Variables
new g_msgSyncGeneral;
public plugin_init()
{
register_plugin(".::LG::. RoundEnd HUD", VERSION, "Shuttle_Wave")
// Roundend Messages/Sounds
register_logevent("eLogRoundEnd", 2, "1=Round_End");
register_message(get_user_msgid("TextMsg"), "msgTextMsg");
// Sync Hud Message (general)
g_msgSyncGeneral = CreateHudSyncObj(); // -1
// Get Maxplayers
g_iMaxPlayers = get_maxplayers();
}
// Block terrorist, counter-terrorist, round-draw, and restart messages
public msgTextMsg()
{
static textmsg[22];
get_msg_arg_string(2, textmsg, charsmax(textmsg));
// Game restarting, block message and replace with our own
if(equal(textmsg, "#Game_will_restart_in") || equal(textmsg, "#Game_Commencing") )
{
// Terrorist or Guards won, block message and replace with our own
else if(equal(textmsg, "#Hostages_Not_Rescued") || equal(textmsg, "#Round_Draw") || equal(textmsg, "#Terrorists_Win") || equal(textmsg, "#CTs_Win") )
}
}
public eLogRoundEnd()
{
if(!fnGetAliveTeamCount(CS_TEAM_T) && ( fnGetAliveTeamCount(CS_TEAM_CT) != 0 ) )
{
{
// Guards Win
set_hudmessage(0, 100, 255, -1.0, -1.0, 0, 0.0, 3.0, 2.0, 1.0, -1);
ShowSyncHudMsg(0, g_msgSyncGeneral, "Guards Win!^n^nAll Prisoners were killed...");
}
}
// Send the custom message, providing it's enabled
else if(!fnGetAliveTeamCount(CS_TEAM_CT) && ( fnGetAliveTeamCount(CS_TEAM_T) != 0 ) )
{
// Prisoners Win
set_hudmessage(255, 180, 30, -1.0, -1.0, 0, 0.0, 3.0, 2.0, 1.0, -1);
ShowSyncHudMsg(0, g_msgSyncGeneral, "Prisoners Win!^n^nAll Guards were killed in action");
}
else
{
{
// No-one Won
set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 0.0, 3.0, 2.0, 1.0, -1);
ShowSyncHudMsg(0, g_msgSyncGeneral, "No one won");
}
}
}
// Function to get alive team count
fnGetAliveTeamCount(CsTeams:Team)
{
new iCount = 0;
for(new i = 1; i <= g_iMaxPlayers; i++)
{
if( ( g_bAlive[i] ) && ( cs_get_user_team(i) == Team ) )
++iCount;
}
return iCount;
}