Skip to content

Hooks

Hooks are the primary way to react to Fazbear's Hunt events and modify the mode's behavior.

Hook categories

How to use hooks

Hooks in GMod are registered via hook.Add:

lua
hook.Add("FH_PlayerShouldJumpscare", "MyUniqueName", function(ply, ent, target)
    -- Prevent players named "Bob" from being screamed
    if target:Nick() == "Bob" then
        return false
    end
end)

Unique names

The second argument of hook.Add is the unique name of your handler. If you register multiple hooks with the same name, the last one will overwrite the previous ones.

Return values

Many FH hooks allow you to cancel an action by returning false:

lua
hook.Add("FH_HandleTaserHit", "BlockTaser", function(ply)
    if ply:IsAdmin() then
        return false -- Taser does not hit admins
    end
end)