[Feature] Client Callbacks

Creates support for utilization of Client Callbacks.
This commit is contained in:
ItsANoBrainer
2022-05-04 21:18:38 -04:00
parent fff42697c6
commit 46ba99291c
6 changed files with 54 additions and 11 deletions
+15
View File
@@ -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({