Hook is Never Fired

This code worked perfectly well before the latest gmod update:


function map_changing()
    // build a list of all the maps on the server
    local map_list = file.Find( "maps/*.bsp", "GAME" )
    // table to store only ttt related maps
    local ttt_map_list = {}
    
    // loop through all the maps and store only ttt related maps
    for k,v in pairs( map_list ) do
        // remove maps with cs_, de_, test_, and gm_ in the title
        if not string.find( map_list[k], "cs_" ) and not string.find( map_list[k], "de_" ) and not string.find( map_list[k], "test_" ) and not string.find( map_list[k], "gm_" ) then
            // remove the .bsp
            local change_map = v:gsub(".bsp", "")
            // add map name to the table
            table.insert(ttt_map_list, change_map)
        end
    end
    
    // change the map randomly
    print("About to change the map.")
    game.ConsoleCommand("ulx map "..table.Random(ttt_map_list).."
")
end

// initial storage of the current round
round_count = 0

// wintype is not used
hook.Add("TTTEndRound", "random_mape_cycle", function(wintype)
    // increment the round number
    round_count = round_count + 1
    
    // check if the count is equal the max round
    // round count should be whatever you've configured in server.cfg
    //if round_count == 1 then
        print("The round count is 1")
        // after 20 seconds call the change map function
        timer.Simple(20, function() map_changing() end)
    //end
    return false
end)

However now this hook is never called. I can see in my console that this script does load correctly. I placed this is gamemodes/terrortown/gamemode which is where it was working before. What am I doing wrong here?

Same issue here if it makes you feel any better.

Do any LUA errors appear?

No lua errors appear. The file loads then just sits there and does nothing. I sat on my server and watched the console for like 4 hours and nothing ever happens when the hook fires except my end of round music script that uses the same hook.

I guess my question is still if you can have two scripts that use the same hooks? Also does it matter if this is running server side or does it have to be client? I don’t understand this problem as, like I said before, this was working fine before the recent update.

If your other script that has the working hook uses the same name identifier


"random_mape_cycle"

Then that’s the cause.