public plugin_init()
{
register_message(get_user_msgid("TeamScore"), "message_teamscore")
register_logevent("logevent_round_end", 2, "1=Round_End")
}
public message_teamscore()
{
static team[2] //team[0] is the only space because team[1] is marked as an string end
get_msg_arg_string(1, team, charsmax(team))
switch (team[0])
{
// CT
case 'C': set_msg_arg_int(2, get_msg_argtype(2), g_scorehumans)
// Terrorist
case 'T': set_msg_arg_int(2, get_msg_argtype(2), g_scorezombies)
}
}
public logevent_round_end()
{
if (!fnGetZombies())
{
// Human team wins
set_hudmessage(0, 0, 200, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_HUMAN")
// Play win sound and increase score
ArrayGetString(sound_win_humans, random_num(0, ArraySize(sound_win_humans) - 1), sound, charsmax(sound))
PlaySound(sound)
g_scorehumans++
// Round end forward
ExecuteForward(g_fwRoundEnd, g_fwDummyResult, ZP_TEAM_HUMAN);
}
else if (!fnGetHumans())
{
// Zombie team wins
set_hudmessage(200, 0, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_ZOMBIE")
// Play win sound and increase score
ArrayGetString(sound_win_zombies, random_num(0, ArraySize(sound_win_zombies) - 1), sound, charsmax(sound))
PlaySound(sound)
g_scorezombies++
// Round end forward
ExecuteForward(g_fwRoundEnd, g_fwDummyResult, ZP_TEAM_ZOMBIE);
}
else
{
// No one wins
set_hudmessage(0, 200, 0, HUD_EVENT_X, HUD_EVENT_Y, 0, 0.0, 3.0, 2.0, 1.0, -1)
ShowSyncHudMsg(0, g_MsgSync, "%L", LANG_PLAYER, "WIN_NO_ONE")
// Play win sound
ArrayGetString(sound_win_no_one, random_num(0, ArraySize(sound_win_no_one) - 1), sound, charsmax(sound))
PlaySound(sound)
g_scorehumans++
// Round end forward
ExecuteForward(g_fwRoundEnd, g_fwDummyResult, ZP_TEAM_NO_ONE);
}
}