Cooldowns

The utils.cooldowns module provides a centralised location for handling player cooldowns across resources.

The sever handles setting and removing cooldowns, the client can simply check.

Functions

check_cooldown()

Checks if a specific action is currently on cooldown for the player.

Function

local function check_cooldown(cooldown_type, is_global, cb)
    utils.callback.cb('boii_utils:sv:check_cooldown', { cooldown_type = cooldown_type, is_global = is_global }, function(active_cooldown)
        if active_cooldown then
            cb(true)
        else
            cb(false)
        end
    end)
end

exports('cooldowns_check_cooldown', check_cooldown)
utils.cooldowns.check = check_cooldown

Example

--- Checks the status of a players 'search_dumpster' cooldown.
utils.cooldowns.check('search_dumpster', false)

--- Checks the global status of 'search_dumpster' cooldown.
utils.cooldowns.check('search_dumpster', true)

Last updated