how to use
local QBCore = exports['qb-core']:GetCoreObject()
Config = Config or {}
Config.Crime = 'robbery:fleeca' -- any unique string key (ex: 'store:24', 'vangelico:main')
Config.CooldownTimer = 120 -- minutes
local function Notify(msg, ntype)
if GetResourceState('ox_lib') == 'started' and lib and lib.notify then
lib.notify({ description = msg, type = ntype or 'inform' })
else
QBCore.Functions.Notify(msg, ntype or 'primary')
end
end
-- Your heist start function (adjust to match your script)
local function StartHeist()
-- Start your heist logic here
end
-- Option A: ox_lib callback (recommended)
CreateThread(function()
local ready, remainingMin = lib.callback.await('watari_cooldown:check', false, Config.Crime)
if ready then
StartHeist()
exports['watari_cooldown']:setCrimeCooldown(Config.Crime, Config.CooldownTimer)
Notify('Cooldown has been initiated', 'success')
else
Notify(('Cooldown is active, ends in %s minutes'):format(tostring(remainingMin)), 'error')
end
end)
-- Option B: client export (same result)
-- CreateThread(function()
-- local ready, remainingMin = exports['watari_cooldown']:isCooldownReady(Config.Crime)
-- if ready then
-- StartHeist()
-- exports['watari_cooldown']:setCrimeCooldown(Config.Crime, Config.CooldownTimer)
-- Notify('Cooldown has been initiated', 'success')
-- else
-- Notify(('Cooldown is active, ends in %s minutes'):format(tostring(remainingMin)), 'error')
-- end
-- end)API Reference (Quick)
Client Exports
Server Exports
ox_lib Callbacks
UI
Last updated