From 53b7516449dc2e3f35ac743c61556bbc258d3d6b Mon Sep 17 00:00:00 2001 From: CheesyPeteza Date: Mon, 7 Mar 2005 23:48:10 +0000 Subject: [PATCH] Made combat countdown work over multiple games on the same map. Sound now stops when a team has won and everything resets. --- plugins/ns/timeleft.sma | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/ns/timeleft.sma b/plugins/ns/timeleft.sma index c7ec9b88..6054fe88 100755 --- a/plugins/ns/timeleft.sma +++ b/plugins/ns/timeleft.sma @@ -38,7 +38,7 @@ new g_TimeSet[32][2] new g_LastTime new g_CountDown new g_Switch -new Float:g_roundStartTime +new Float:g_roundStartTime = 999999.9 new bool:is_combat public plugin_init() { @@ -53,7 +53,7 @@ public plugin_init() { new szMapName[4] get_mapname(szMapName, 3) if (equal(szMapName, "co_")) { - register_event("PlayHUDNot", "roundStart", "bc", "1=0", "2=56") + register_event("PlayHUDNot", "roundChange", "bc", "1=0", "2>56", "2<59") is_combat = true } } @@ -232,8 +232,17 @@ public timeRemain(param[]){ } } -public roundStart() { - g_roundStartTime = get_gametime() +public roundChange() { + switch ( read_data(2) ) { + case 56: g_roundStartTime = get_gametime() + case 57: { + g_roundStartTime = 999999.9 // Stop the countdown when a team wins + g_CountDown = 0 + g_Switch = 0 + remove_task(34543) + set_task(0.8,"timeRemain",8648458,"",0,"b") + } + } } getCombatTimeLeft() {