Skip to content

Commit

Permalink
refactor: switch callback system (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Manason authored Jun 2, 2023
1 parent 37814b9 commit 934567c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ RegisterNetEvent("hud:client:resetStorage", function()
if Menu.isResetSoundsChecked then
TriggerServerEvent("InteractSound_SV:PlayOnSource", "airwrench", 0.1)
end
QBCore.Functions.TriggerCallback('hud:server:getMenu', function(menu) loadSettings(menu); SetResourceKvp('hudSettings', json.encode(menu)) end)
local menu = lib.callback.await('hud:server:getMenu')
loadSettings(menu)
SetResourceKvp('hudSettings', json.encode(menu))
end)

-- Notifications
Expand Down
4 changes: 2 additions & 2 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ RegisterNetEvent('hud:server:RelieveStress', function(amount)
})
end)

QBCore.Functions.CreateCallback('hud:server:getMenu', function(_, cb)
cb(Config.Menu)
lib.callback.register('hud:server:getMenu', function()
return Config.Menu
end)

0 comments on commit 934567c

Please sign in to comment.