Round Code ( Needs repair )


ROUND_TIMER = {}

ROUND_TIMER.RoundTime = {}
ROUND_TIMER.RoundTime[Assault] = 600 
ROUND_TIMER.RoundTime[Preparation] = 8 

ROUND_TIMER.Time_Began = CurTime()
ROUND_TIMER.Rounds = #ROUND_TIMER.RoundTime
ROUND_TIMER.Round = "Assault"

ROUND_TIMER.GetRound = function()
    return ROUND_TIMER.Round
end

ROUND_TIMER.NextRound = function()
    if ROUND_TIMER.Round == "Preparation" then
        ROUND_TIMER.Round = "Assault"
    else
        ROUND_TIMER.Round = "Preparation"
    end

    if SERVER then
        umsg.Start("ROUND_TIMER_UpdateClient")
            umsg.Short(ROUND_TIMER.Round)
        umsg.End()
    end

    hook.Call("RoundInitiated")
    hook.Call("Round_Looping")
end

if SERVER then 
    ROUND_TIMER.Loop = function()
        timer.Adjust("Round_Timer_Mod", ROUND_TIMER.RoundTime[ROUND_TIMER.Round], 0, function()
            ROUND_TIMER:NextRound()
        end)
    end
    hook.Add("Round_Looping", "Beginning the loop, this creates a never ending round system.", ROUND_TIMER.Loop)

    timer.Create("Round_Timer_Mod", ROUND_TIMER.RoundTime["ROUND_TIMER.Round"], 0, function()end)
    ROUND_TIMER:Loop()



    ROUND_TIMER.DisableSpawning = function(pl)
        if ROUND_TIMER.Round == "Assault" then
            return false
        end
    end
    hook.Add("PlayerDeathThink", "Disable spawning if the round is in progress.", ROUND_TIMER.DisableSpawning)

    ROUND_TIMER.DeathCheck = function(pl, attacker, dmginfo)
        if ROUND_TIMER.Round == "Assault" then
            local Num = 0
            for k, v in pairs(player.GetAll()) do
                if !v:Alive() then
                    Num = Num+1
                end
            end

            if Num >= #player.GetAll() then
                ROUND_TIMER:NextRound()
            end
        end
    end
    hook.Add("PlayerDeathThink", "Disable spawning until new round.", ROUND_TIMER.DeathCheck)

    ROUND_TIMER.Initiate_Round = function()
        if ROUND_TIMER.Round == "Assault" then
            for k, v in pairs(player.GetAll()) do
                v:PrintMessage(HUD_PRINTCENTER, "A new round has begun!")
                if !v:Alive() then
                    v:Spawn()
                end
            end
        end
    end
    hook.Add("RoundInitiated", "Round has Initiated.", ROUND_TIMER.Initiate_Round)

elseif CLIENT then 
    surface.CreateFont("ROUND_TIMER_Display", {
        font        = "Arial",
        size        = 25,
        weight        = 1000
    })

    usermessage.Hook("ROUND_TIMER_UpdateClient", function(msg)
        ROUND_TIMER.Round = msg:ReadShort()
        ROUND_TIMER.Time_Began = CurTime()
    end)

    ROUND_TIMER.HUD = function()
        draw.SimpleTextOutlined("Round ("..ROUND_TIMER.Round..") ends in: "..math.Round((ROUND_TIMER.Time_Began+ROUND_TIMER.RoundTime[ROUND_TIMER.Round])-CurTime()), "ROUND_TIMER_Display", ScrW()/2, 20, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
    end
    hook.Add("HUDPaint", "Draw Round Timer display.", ROUND_TIMER.HUD)
end

Timer doesn’t even show up. Basically supposed to show either “Assault Ends In: (time left)” or "Preparation Ends In: (time left)

Please help!

What have you tried to fix it?

I’ve tried to fix it multiple times with no luck :confused:

Probably just another person hoping to get spoonfed. We’re not going to help you if you aren’t going to even attempt to fix it yourself. This isn’t the place for this. If there is a problem, contact the author of the script.

I’m not asking to be spoon fed. And read my above post, I’ve attempted to fix it multiple times.

Your above post doesn’t say that. And if you did, then what did you try?

I tried to edit the string names/values, make the arithmetic more simple, and changed the NextRound function multiple times ( along with the DrawText at the bottom ).

Show us. Saying you tried to make the arithmetic more simple is a fluff phrase, it means nothing.

You changed the NextRound function - how?

What did you edit the strings to?

Honestly sounds like a bunch of bullshit. Contact the author if he’s even alive (I see umsg’s so probs not) or go to gmodstore if you are going to just lie…

Come on guys, he said he tried to replace strings and stuff, obviously that means we have to fix that

@smg13

Have you tried just setting the draw.SimpleText() to just a normal string without a variable? Is the HUDPaint hook even being called?

**EDIT:
**I would change this:

[lua]ROUND_TIMER.HUD = function() draw.SimpleTextOutlined(“Round (”…ROUND_TIMER.Round…") ends in: "…math.Round((ROUND_TIMER.Time_Began+ROUND_TIMER.RoundTime[ROUND_TIMER.Round])-CurTime()), “ROUND_TIMER_Display”, ScrW()/2, 20, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)endhook.Add(“HUDPaint”, “Draw Round Timer display.”, ROUND_TIMER.HUD)
[/lua]

To this:

[lua]hook.Add(“HUDPaint”, “Draw Round Timer display.”, function() draw.SimpleTextOutlined(“Temp Timer Display”, “ROUND_TIMER_Display”, ScrW()/2, 20, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)end)
[/lua]