Skip to content

Commit

Permalink
Merge branch 'main' into player-annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ChatDisabled committed May 11, 2023
2 parents 5e1d60c + 2f2e08e commit 45305a3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,15 @@ end)
-- Callback Events --

-- Client Callback
---@deprecated call a function instead
RegisterNetEvent('QBCore:Client:TriggerClientCallback', function(name, ...)
QBCore.Functions.TriggerClientCallback(name, function(...)
TriggerServerEvent('QBCore:Server:TriggerClientCallback', name, ...)
end, ...)
end)

-- Server Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Client/ instead
RegisterNetEvent('QBCore:Client:TriggerCallback', function(name, ...)
if QBCore.ServerCallbacks[name] then
QBCore.ServerCallbacks[name](...)
Expand Down
3 changes: 3 additions & 0 deletions client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,19 @@ end
-- Callback Functions --

-- Client Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Client/ instead
function QBCore.Functions.CreateClientCallback(name, cb)
QBCore.ClientCallbacks[name] = cb
end

---@deprecated call a function instead
function QBCore.Functions.TriggerClientCallback(name, cb, ...)
if not QBCore.ClientCallbacks[name] then return end
QBCore.ClientCallbacks[name](cb, ...)
end

-- Server Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Client/ instead
function QBCore.Functions.TriggerCallback(name, cb, ...)
QBCore.ServerCallbacks[name] = cb
TriggerServerEvent('QBCore:Server:TriggerCallback', name, ...)
Expand Down
5 changes: 5 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@ QBCore = {}
QBCore.PlayerData = {}
QBCore.Config = QBConfig
QBCore.Shared = QBShared

---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Client/ instead
QBCore.ClientCallbacks = {}

---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Client/ instead
QBCore.ServerCallbacks = {}

IsLoggedIn = false

exports('GetCoreObject', function()
Expand Down
2 changes: 2 additions & 0 deletions server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ end)
-- Callback Events --

-- Client Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Server instead
RegisterNetEvent('QBCore:Server:TriggerClientCallback', function(name, ...)
if QBCore.ClientCallbacks[name] then
QBCore.ClientCallbacks[name](...)
Expand All @@ -166,6 +167,7 @@ RegisterNetEvent('QBCore:Server:TriggerClientCallback', function(name, ...)
end)

-- Server Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Server instead
RegisterNetEvent('QBCore:Server:TriggerCallback', function(name, ...)
local src = source
QBCore.Functions.TriggerCallback(name, src, function(...)
Expand Down
3 changes: 3 additions & 0 deletions server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,19 @@ end
-- Callback Functions --

-- Client Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Server instead
function QBCore.Functions.TriggerClientCallback(name, source, cb, ...)
QBCore.ClientCallbacks[name] = cb
TriggerClientEvent('QBCore:Client:TriggerClientCallback', source, name, ...)
end

-- Server Callback
---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Server instead
function QBCore.Functions.CreateCallback(name, cb)
QBCore.ServerCallbacks[name] = cb
end

---@deprecated call a function instead
function QBCore.Functions.TriggerCallback(name, source, cb, ...)
if not QBCore.ServerCallbacks[name] then return end
QBCore.ServerCallbacks[name](source, cb, ...)
Expand Down
4 changes: 4 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
QBCore = {}
QBCore.Config = QBConfig
QBCore.Shared = QBShared

---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Server instead
QBCore.ClientCallbacks = {}

---@deprecated use https://overextended.github.io/docs/ox_lib/Callback/Lua/Server instead
QBCore.ServerCallbacks = {}

exports('GetCoreObject', function()
Expand Down

0 comments on commit 45305a3

Please sign in to comment.