mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
[Feature] Client Callbacks
Creates support for utilization of Client Callbacks.
This commit is contained in:
@@ -117,11 +117,26 @@ function QBCore.Debug(resource, obj, depth)
|
||||
TriggerServerEvent('QBCore:DebugSomething', resource, obj, depth)
|
||||
end
|
||||
|
||||
-- Callback Functions --
|
||||
|
||||
-- Client Callback
|
||||
function QBCore.Functions.CreateClientCallback(name, cb)
|
||||
QBCore.ClientCallbacks[name] = cb
|
||||
end
|
||||
|
||||
function QBCore.Functions.TriggerClientCallback(name, cb, ...)
|
||||
if not QBCore.ClientCallbacks[name] then return end
|
||||
QBCore.ClientCallbacks[name](cb, ...)
|
||||
end
|
||||
|
||||
-- Server Callback
|
||||
function QBCore.Functions.TriggerCallback(name, cb, ...)
|
||||
QBCore.ServerCallbacks[name] = cb
|
||||
TriggerServerEvent('QBCore:Server:TriggerCallback', name, ...)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function QBCore.Functions.Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
|
||||
if GetResourceState('progressbar') ~= 'started' then error('progressbar needs to be started in order for QBCore.Functions.Progressbar to work') end
|
||||
exports['progressbar']:Progress({
|
||||
|
||||
Reference in New Issue
Block a user