mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
fix createCallback complaining on client side
This commit is contained in:
@@ -13,21 +13,23 @@
|
|||||||
--- end)
|
--- end)
|
||||||
--- ```
|
--- ```
|
||||||
function createCallback(callbackName, funct)
|
function createCallback(callbackName, funct)
|
||||||
if isStarted(OXLibExport) then
|
if isServer() then
|
||||||
lib.callback.register(callbackName, funct)
|
if isStarted(OXLibExport) then
|
||||||
else
|
lib.callback.register(callbackName, funct)
|
||||||
local adaptedFunction = function(source, cb, ...)
|
|
||||||
local result = funct(source, ...)
|
|
||||||
cb(result)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isStarted(QBExport) then
|
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
|
||||||
Core.Functions.CreateCallback(callbackName, adaptedFunction)
|
|
||||||
elseif isStarted(ESXExport) then
|
|
||||||
ESX.RegisterServerCallback(callbackName, adaptedFunction)
|
|
||||||
else
|
else
|
||||||
print("^6Bridge^7: ^1ERROR^7: ^3Can't find any script to register callback with", callbackName)
|
local adaptedFunction = function(source, cb, ...)
|
||||||
|
local result = funct(source, ...)
|
||||||
|
cb(result)
|
||||||
|
end
|
||||||
|
|
||||||
|
if isStarted(QBExport) then
|
||||||
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
|
Core.Functions.CreateCallback(callbackName, adaptedFunction)
|
||||||
|
elseif isStarted(ESXExport) then
|
||||||
|
ESX.RegisterServerCallback(callbackName, adaptedFunction)
|
||||||
|
else
|
||||||
|
print("^6Bridge^7: ^1ERROR^7: ^3Can't find any script to register callback with", callbackName)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user