This commit is contained in:
MrNewb committed 2025-07-29 11:25:41 -04:00
commit 3bb5bd7ad6
5 files changed
+33 -8

No files matched your search

+10 -1
View File
@@ -8,7 +8,16 @@ Input = {}
function Input.Open(title, data, isQBFormat, submitText)
local inputs = data.inputs
if isQBFormat then
return lib.inputDialog(title, QBToOxInput(inputs))
local convertedData = {}
local returnData = lib.inputDialog(title, QBToOxInput(inputs))
for i, v in pairs(inputs) do
for k, j in pairs(returnData or {}) do
if k == v.name then
convertedData[v.name] = j
end
end
end
return convertedData
else
return lib.inputDialog(title, data)
end
+1 -1
View File
@@ -24,7 +24,7 @@ function Input.Open(title, data, isQBFormat, submitText)
for i, v in pairs(input) do
for k, j in pairs(returnData) do
if k == v.name then
convertedData[tonumber(i)] = j
convertedData[v.name] = j
end
end
end
+1 -1
View File
@@ -25,7 +25,7 @@ local function QBToOxMenu(id, menu)
description = v.txt,
icon = v.icon,
args = v.params.args,
onSelect = function(selected, secondary, args)
onSelect = v.action or function(selected, secondary, args)
local params = menu[id]?.options?[selected]?.params
if not params then return end
local event = params.event
+10 -4
View File
@@ -22,8 +22,13 @@ Target = Target or {}
Target.FixOptions = function(options)
for k, v in pairs(options) do
local action = v.onSelect or v.action
if not action then
print(("Target option (%s) %s is missing an 'onSelect' or 'action' function."):format(k, v.label))
if not action then
local _type = v.type
if _type and _type == "server" then
v.serverEvent = v.event
v.event = nil
end
else
local select = function(entityOrData)
if type(entityOrData) == 'table' then
@@ -31,9 +36,10 @@ Target.FixOptions = function(options)
end
return action(entityOrData)
end
options[k].onSelect = select
options[k].groups = v.job or v.groups
v.onSelect = select
end
v.groups = v.job or v.groups
end
return options
end
+11 -1
View File
@@ -24,14 +24,24 @@ local qb_target = exports['qb-target']
Target.FixOptions = function(options)
for k, v in pairs(options) do
local action = v.onSelect or v.action
local select = function(entityOrData)
local select = action and function(entityOrData)
if type(entityOrData) == 'table' then
return action(entityOrData.entity)
end
return action(entityOrData)
end
if v.serverEvent then
v.type = "server"
v.event = v.serverEvent
elseif v.event then
v.type = "client"
v.event = v.event
print("Fixing options for target:", k, "with event:", v.event)
end
options[k].action = select
options[k].job = v.job or v.groups
options[k].jobType = v.jobType
print("Fixing options for target:", k, "with job:", options[k].job, "and jobType:", options[k].jobType)
end
return options
end