From 630bdd69566704992cbad3bf4880697d1fbb2204 Mon Sep 17 00:00:00 2001 From: Sky <108126483+cityparadise@users.noreply.github.com> Date: Sun, 20 Apr 2025 11:20:34 +0100 Subject: [PATCH] Update _qb-input.lua (again :P ) - Added single checkpoint usability - Added check for options table variable - Added checked option to be passed for toggling box as true/ false --- modules/input/_qb-input.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/input/_qb-input.lua b/modules/input/_qb-input.lua index b08b0f1..375c052 100644 --- a/modules/input/_qb-input.lua +++ b/modules/input/_qb-input.lua @@ -47,8 +47,12 @@ function OxToQBInput(data) elseif v.type == "checkbox" then input.text = "" input.options = {} - for k, j in pairs(v.options) do - table.insert(input.options, {value = j.value, text = j.label}) + if v.options then -- Checks if options varible is valid so checkboxes are bundled together (not used by ox for each checkpoint) + for k, j in pairs(v.options) do + table.insert(input.options, {value = j.value, text = j.label, checked = j.checked}) -- added checked option (used to show box as ticked or not) + end + else -- If options is not valid or people pass a single checkbox then it will be a single checkbox per entry + table.insert(input.options, {value = v.value, text = v.label, checked = v.checked}) -- Kept value just incase it's used for other stuffs end end table.insert(returnData, input)