• Modifying Round based gamemode timer
    0 replies, posted
Hello, I am using fretta for a PropHunt Enhanced server, and very recently I stumbled upon this interesting function: --You can add round time by calling this (takes time in seconds) function GM:AddRoundTime( iAddedTime ) if( !GAMEMODE:InRound() ) then // don't add time if round is not in progress return end SetGlobalFloat( "RoundEndTime", GetGlobalFloat( "RoundEndTime", CurTime() ) + iAddedTime ); timer.Adjust( "RoundEndTimer", GetGlobalFloat( "RoundEndTime" ) - GetGlobalFloat( "RoundStartTime" ), 0, function() GAMEMODE:RoundTimerEnd() end ); end I want to use this function as a command to add seconds to the current round. Unfortunately, the seconds that get added to the hud timer works, but the actual round timer is off. To be more precise, when I try to use something like GAMEMODE:AddRoundTime(time) with 'time' as the command variable, instead of simply adding that many seconds to the CurTime(), it will set the timer to the default roundDuration and THEN add the amount of seconds that I input. Example: Convar for the roundDuration is set to 300 seconds (5 min), and we are currently on Round 1 with 1:21 as the remaining time. I run the command with the variable: 17. The hud timer will correctly display that I therefore have 1:38 remaining time. However if the actual round timer will not reach 0 (and end the round) until 317 seconds have passed since I ran the command. I've tried locally defining roundDuration and using that to substract from the timer.Adjust, which gives a closer result, but I'm aware that something is wrong with how this is set up, and I can't figure out what. The amount of time related functions ends up being a little overwhelming, so after having tried to modify it many different ways I'm hoping someone can help me out! Thanks.
Sorry, you need to Log In to post a reply to this thread.