Displaying how many rounds are left until a map change?


I’m currently looking for any help in creating a script that will broadcast through chat how many rounds are left on a particular map until a map change. This is for a Prop Hunt server, source found here.

I’ve got the global variable that stores how many rounds per map until a change (10), but struggling on how I can create a system that will display the amount of rounds left (10 - Current Round Number for example) until the server changes maps.

So I’ve written this, and now I’ve got a more specific question.


-- When Round Ends

PrintMessage( HUD_PRINTTALK, CURRENT_ROUND_NUMBER .. " rounds left until map change.")

Basically this code is run whenever a round ends (As outlined in the source code of the mode). The question I now face is how to properly implement this; the Global Variable of CURRENT_ROUND_NUMBER is found within sh_config.lua, and I’m uncertain if I can actually change this variable all the way in init.lua. Does anyone have experience doing something like this? Would I be able to use a local variable within Init.lua, or is there a method I can link up these files to allow changes?

Cheers for reading.

Use this:



Thank you!

Sorry to bump, but does anyone know if this code will work? Not near a test server at the moment.

SetGlobalInt("CURRENT_ROUND_NUMBER", 10 - "RoundNumber")

PrintMessage( HUD_PRINTTALK, GetGlobalInt("CURRENT_ROUND_NUMBER", 0) .. " rounds left until map change.")

I’m not sure if Garry’s Mod will allow me to set the value for CURRENT_ROUND_NUMBER through use of arithmetic, in the event this works then awesome, if it doesn’t does anyone have any suggestions on how I should rectify this?