• GetGlobalInt ?
    7 replies, posted
Hi, I'm working on an addon that initiates a fretta like map voting system. Everything is working fine except, the addon doesn't know when the 10th round has ended and when to start the voting sequence. Below is the code for checking for a map switch if GAMEMODE_NAME == "prop_hunt" then         function CheckForMapSwitch()            -- Check for mapswitch            local rounds_left = math.max(0, GetGlobalInt("no idea", 10) - 1)            SetGlobalInt("no idea", rounds_left) As you can see I've got no idea what the interger for rounds per map or rounds left would be.. I've been searching for weeks now and sadly to no avail. I'm hoping this is the reason it won't automatically trigger the voting system as everything else including my gamemode is set to 10 rounds per map etc. Any help would be great.
have you actually called the function because that code is just creating the function
Yes, in the rest of the code, however if you look at the code you'll sere "no idea" - I don't know what the interger is for calling rounds_left in Prop Hunt, that's one of the issues. The server is permanently stuck on 1 map rather than ending at 10 rounds and triggering AutoVote for players to choose their next map. Here's the rest of the code for this file hook.Add( "Initialize", "AutoMapVote", function()       if GAMEMODE_NAME == "prop_hunt" then         function CheckForMapSwitch()            -- Check for mapswitch            local rounds_left = math.max(0, GetGlobalInt("Whatever Int goes here", 10) - 1)            SetGlobalInt("Fuck knows what it is", rounds_left)              local time_left = math.max(0, (GetConVar("timeleft"):GetInt() * 60) - CurTime())            local switchmap = true            local nextmap = string.upper(game.GetMapNext())               if rounds_left <= 0 then               LANG.Msg("limit_round", {mapname = nextmap})               switchmap = true             elseif time_left <= 0 then               LANG.Msg("limit_time", {mapname = nextmap})               switchmap = true             end             if switchmap then                 timer.Stop("end2prep")                 MapVote.Start(nil, nil, nil, nil)             end         end       end              if GAMEMODE_NAME == "deathrun" then           function RTV.Start()             MapVote.Start(nil, nil, nil, nil)           end       end end ) So the code works perfectly fine for everything else, and works fine if I call a vote via the custom ULX command however, its not triggering automatically.
Maybe there is a round handler in the game mode folder? Like rounds.lua or something then you can look through it and see if you can find
i've had a look sadly there's nothing that manages rounds. The integer I found, it was just rounds_per_map and rounds_left but still doesn't work urgh.
prophunt/round_controller.lua at be9ffecd2ed108738841ca73ba123a5.. SetGlobalInt( "RoundNumber", iNum )
There you go he seemed to find it lol
Instead of copying the ttt round vote system, use hook.Add for the OnEndRound hook then write a check for map switch function that compares RoundNumber to 10 and if they are same executes the map vote
Sorry, you need to Log In to post a reply to this thread.