• need help with global timer
    0 replies, posted
hi.. does anybody know how i can make this count down from 30:00 instead of 60:00? also... is there a way i can make it stop at 0:00 for about 5 minutes then loop back to 30:00 instead of instantly looping when it hits 0:00? [CODE]-- Server util.AddNetworkString("Countdown") function StartCountdown( time, func ) net.Start("Countdown") net.WriteFloat( CurTime() + time ) net.Broadcast() timer.Simple( time, function() func() end) end function NormalRound() StartCountDown( 30 * 60, SpecialRound ) PrintMessage( HUD_PRINTTALK, "Rampant Time has ended!") BroadcastLua("surface.PlaySound(\"sound/endrampant.wav\")") end function SpecialRound() StartCountdown( 10 * 60, NormalRound ) PrintMessage( HUD_PRINTTALK, "Rampant Time Has Started and will last for 10 minutes!") BroadcastLua("surface.PlaySound(\"sound/beginrampant.wav\")") end NormalRound() -- Client local time = 0 net.Receive("Countdown", function() time = net.ReadFloat() end) hook.Add("HUDPaint", "Sweg", function() draw.DrawText( string.ToMinutesSeconds(time - CurTime()), "TargetID", ScrW() * 0.1, ScrH() * 0.1, Color( 255,255,255,255 ), TEXT_ALIGN_CENTER ) end)[/CODE]
Sorry, you need to Log In to post a reply to this thread.