• Current Round help
    4 replies, posted
I'm trying to get the current round to show on my HUD, I got it to print the current round in sv_round but it just comes up nil in cl_init, how can I send to to cl_init? I'm using [url]https://github.com/Mr-Gash/GMod-Deathrun[/url] sv_round [code] local rounds_played = 0 function GM:GetRoundsPlayed() return rounds_played end -- In ROUND_ENDING rounds_played = rounds_played + 1 [/code]
[url]https://wiki.garrysmod.com/page/net/Broadcast[/url]
[QUOTE=stickman14714;52369346][url]https://wiki.garrysmod.com/page/net/Broadcast[/url][/QUOTE] How do I receive and use it with draw.SimpleText() in cl_init? I've never worked with net messages and the wiki was confusing for my situation
[QUOTE=Reject42;52369361]How do I receive and use it with draw.SimpleText() in cl_init? I've never worked with net messages and the wiki was confusing for my situation[/QUOTE] Well, you could also just create a GlobalInt that keeps track of the round number. I think that would be easier. sv [code] SetGlobalInt("dr_roundNumber", 1) GM.RoundFunctions = { [ROUND_ENDING] = function( gm, winner ) --add the following to ROUND_ENDING local prevRoundNum = GetGlobalInt("dr_roundNumber", 0) SetGlobalInt("dr_roundNumber", prevRoundNum + 1) end, } [/code] cl [code] hook.Add("HUDPaint", "dr_paintRoundNumber", function() draw.SimpleText(tostring(GetGlobalInt("dr_roundNumber", 0), font, x, y, colour, 0, 0) end) [/code] [URL]http://wiki.garrysmod.com/page/draw/SimpleText[/URL]
[QUOTE=stickman14714;52369485]Well, you could also just create a GlobalInt that keeps track of the round number. I think that would be easier. sv [code] SetGlobalInt("dr_roundNumber", 1) GM.RoundFunctions = { [ROUND_ENDING] = function( gm, winner ) --add the following to ROUND_ENDING local prevRoundNum = GetGlobalInt("dr_roundNumber", 0) SetGlobalInt("dr_roundNumber", prevRoundNum + 1) end, } [/code] cl [code] hook.Add("HUDPaint", "dr_paintRoundNumber", function() draw.SimpleText(tostring(GetGlobalInt("dr_roundNumber", 0), font, x, y, colour, 0, 0) end) [/code] [URL]http://wiki.garrysmod.com/page/draw/SimpleText[/URL][/QUOTE] Thank you so much!
Sorry, you need to Log In to post a reply to this thread.