Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openCustoms export for other scripts #35

Merged
merged 8 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions client/menus/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local dragcam = require('client.dragcam')
local startDragCam = dragcam.startDragCam
local stopDragCam = dragcam.stopDragCam
local config = require 'config.client'
openedWithExports = false

local menu = {
id = mainMenuId,
Expand Down Expand Up @@ -117,18 +118,34 @@ end
menu.onClose = function()
inMenu = false
stopDragCam()
lib.showTextUI(locale('textUI.tune'), {
icon = 'fa-solid fa-car',
position = 'left-center',
})
if not openedWithExports then
lib.showTextUI(locale('textUI.tune'), {
icon = 'fa-solid fa-car',
position = 'left-center',
})
end
TriggerServerEvent('qbx_customs:server:saveVehicleProps')
end

lib.callback.register('qbx_customs:client:vehicleProps', function()
return lib.getVehicleProperties(vehicle)
end)

exports('OpenMenu', function()
openedWithExports = true
if not cache.vehicle or inMenu then return false end
vehicle = cache.vehicle
SetVehicleModKit(vehicle, 0)
menu.options = main()
lib.registerMenu(menu, onSubmit)
lib.showMenu(menu.id, 1)
disableControls()
startDragCam(vehicle)
return true
end)

return function()
openedWithExports = false
if not cache.vehicle or inMenu then return end
vehicle = cache.vehicle
SetVehicleModKit(vehicle, 0)
Expand Down
12 changes: 6 additions & 6 deletions client/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function InstallMod(duplicate, mod, props, level)
exports.qbx_core:Notify(locale('notifications.error.alreadyInstalled'), 'error')
return false
end

local success = lib.callback.await('qbx_customs:server:pay', false, mod, level)
local success = openedWithExports or lib.callback.await('qbx_customs:server:pay', false, mod, level)
if success then
exports.qbx_core:Notify(
props?.title or locale('notifications.props.installTitle'),
Expand All @@ -39,10 +39,10 @@ function InstallMod(duplicate, mod, props, level)
props?.icon or 'fa-solid fa-wrench',
props?.iconColor
)
qbx.playAudio({
audioName = 'PICK_UP',
audioRef = 'HUD_FRONTEND_DEFAULT_SOUNDSET'
})
qbx.playAudio({
audioName = 'PICK_UP',
audioRef = 'HUD_FRONTEND_DEFAULT_SOUNDSET'
})
return true
end

Expand Down
Loading