Input update
Restructured inputs to match rest of bridge also removed qbobject from clothing
This commit is contained in:
1 parent
7610cadf04
commit
7ea4c9c38c
8 files changed
+372
-121
No files matched your search
@@ -0,0 +1,47 @@
|
||||
local resourceName = "qb-input"
|
||||
local configValue = BridgeClientConfig.InputSystem
|
||||
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end
|
||||
|
||||
Input = {}
|
||||
|
||||
|
||||
-- this probably needs improvement
|
||||
function Input.Open(title, data, isQBFormat, submitText)
|
||||
local input = data.inputs
|
||||
if not isQBFormat then
|
||||
input = OxToQBInput(data)
|
||||
end
|
||||
local returnData = exports['qb-input']:ShowInput({
|
||||
header = title,
|
||||
submitText = submitText or "Submit",
|
||||
inputs = input
|
||||
})
|
||||
if not returnData then return end
|
||||
print(json.encode(returnData))
|
||||
if returnData[1] then return returnData end
|
||||
--converting to standard format (ox)
|
||||
local convertedData = {}
|
||||
if isQBFormat then
|
||||
for i, v in pairs(input) do
|
||||
print("Converting input: " .. v.name)
|
||||
for k, j in pairs(returnData) do
|
||||
if k == v.name then
|
||||
convertedData[tonumber(i)] = j
|
||||
end
|
||||
end
|
||||
end
|
||||
return convertedData
|
||||
end
|
||||
|
||||
for i, v in pairs(returnData) do
|
||||
local index = i and tonumber(i)
|
||||
if not index then
|
||||
table.insert(convertedData, v)
|
||||
else
|
||||
convertedData[index] = v
|
||||
end
|
||||
end
|
||||
return convertedData
|
||||
end
|
||||
|
||||
return Input
|
||||
Reference in new issue
Block a user