Код:
// Log Event Round End
public logevent_round_end()
{
// Prevent this from getting called twice when restarting (bugfix)
static Float:lastendtime, Float:current_time
current_time = get_gametime()
if (current_time - lastendtime < 0.5) return;
lastendtime = current_time
// Temporarily save player stats?
if (get_pcvar_num(cvar_statssave))
{
static id, team
for (id = 1; id <= g_maxplayers; id++)
{
// Not connected
if (!g_isconnected[id])
continue;
team = fm_cs_get_user_team(id)
// Not playing
if (team == FM_CS_TEAM_SPECTATOR || team == FM_CS_TEAM_UNASSIGNED)
continue;
save_stats(id)
}
}
// Round ended
g_endround = true
// Stop old tasks (if any)
remove_task(TASK_WELCOMEMSG)
remove_task(TASK_MAKEZOMBIE)
// Stop ambience sounds
if ((g_ambience_sounds[AMBIENCE_SOUNDS_NEMESIS] && g_nemround) || (g_ambience_sounds[AMBIENCE_SOUNDS_SURVIVOR] && g_survround) || (g_ambience_sounds[AMBIENCE_SOUNDS_SWARM] && g_swarmround) || (g_ambience_sounds[AMBIENCE_SOUNDS_PLAGUE] && g_plagueround) || (g_ambience_sounds[AMBIENCE_SOUNDS_INFECTION] && !g_nemround && !g_survround && !g_swarmround && !g_plagueround))
{
remove_task(TASK_AMBIENCESOUNDS)
ambience_sound_stop()
}
// Show HUD notice, play win sound, update team scores...
static sound[64]
if (!fnGetHumans())
{
// Zombie team wins
client_print(0, print_center, "%L", LANG_PLAYER, "WIN_ZOMBIE")
// Play win sound and increase score, unless game commencing
ArrayGetString(sound_win_zombies, random_num(0, ArraySize(sound_win_zombies) - 1), sound, charsmax(sound))
PlaySound(sound)
if (!g_gamecommencing) g_scorezombies++
// Round end forward
ExecuteForward(g_fwRoundEnd, g_fwDummyResult, ZP_TEAM_ZOMBIE);
}
else
{
// Human team wins
client_print(0, print_center, "%L", LANG_PLAYER, "WIN_HUMAN")
// Play win sound and increase score, unless game commencing
ArrayGetString(sound_win_humans, random_num(0, ArraySize(sound_win_humans) - 1), sound, charsmax(sound))
PlaySound(sound)
if (!g_gamecommencing) g_scorehumans++
// Round end forward
ExecuteForward(g_fwRoundEnd, g_fwDummyResult, ZP_TEAM_HUMAN);
}
// Game commencing triggers round end
g_gamecommencing = false
// Balance the teams
balance_teams()
}