@@ -5,6 +5,7 @@ local PrivateJet = require("includes.modules.PrivateJet")
55local PrivateLimo = require (" includes.modules.PrivateLimo" )
66local t_GamePeds = require (" includes.data.peds" )
77local PreviewService = require (" includes.services.PreviewService" )
8+ local Weapons = require (" includes.data.weapons" )
89local i_SelectedSidebarItem = 1
910local i_WeaponCategoryIndex = 1
1011local i_WeaponIndex = 1
@@ -45,18 +46,20 @@ local t_SelectedLimo = {}
4546local t_WeaponList = {}
4647local t_MainUIfooter = {}
4748local t_SelectedEscortGroup = {}
49+
50+ --- @type array< {name : string , list ?: array<hash> } >
4851local t_WeaponCategories = {
4952 { name = " None" },
50- { name = " Melee" , groupHash = 2685387236 },
51- { name = " Pistols" , groupHash = 416676503 },
52- { name = " SMGs" , groupHash = 3337201093 },
53- { name = " Shotguns" , groupHash = 860033945 },
54- { name = " Assault Rifles" , groupHash = 970310034 },
55- { name = " Machine Guns" , groupHash = 1159398588 },
56- { name = " Sniper Rifles" , groupHash = 3082541095 },
57- { name = " Heavy Weapons" , groupHash = 2725924767 },
58- { name = " Throwables" , groupHash = 1548507267 },
59- { name = " Miscellaneous" , groupHash = 4257178988 },
53+ { name = " Melee" , list = Weapons . Melee },
54+ { name = " Pistols" , list = Weapons . Pistols },
55+ { name = " SMGs" , list = Weapons . SMG },
56+ { name = " Shotguns" , list = Weapons . Shotguns },
57+ { name = " Assault Rifles" , list = Weapons . AssaultRifles },
58+ { name = " Machine Guns" , list = Weapons . MachineGuns },
59+ { name = " Sniper Rifles" , list = Weapons . SniperRifles },
60+ { name = " Heavy Weapons" , list = Weapons . Heavy },
61+ { name = " Throwables" , list = Weapons . Throwables },
62+ { name = " Miscellaneous" , list = Weapons . Misc },
6063}
6164-- local t_NewEscortGroup = {
6265-- name = "N/A",
@@ -215,41 +218,43 @@ local function BodyguardSpawnFooter()
215218 ImGui .PushItemWidth (200 )
216219 if ImGui .BeginCombo (" Category" , t_WeaponCategories [i_WeaponCategoryIndex ].name ) then
217220 for i , cat in ipairs (t_WeaponCategories ) do
218- if cat .groupHash then
219- local is_selected = (i_WeaponCategoryIndex == i )
221+ if (not cat .list ) then
222+ goto continue
223+ end
220224
221- if ImGui .Selectable (cat .name , is_selected ) then
222- i_WeaponCategoryIndex = i
223- end
225+ local is_selected = (i_WeaponCategoryIndex == i )
226+ if ImGui .Selectable (cat .name , is_selected ) then
227+ i_WeaponCategoryIndex = i
228+ end
224229
225- if GUI :IsItemClicked (0 ) then
226- GUI :PlaySound (" Nav" )
227- t_WeaponList = weapons . get_all_weapons_of_group_type ( cat .groupHash )
228- end
230+ if GUI :IsItemClicked (0 ) then
231+ GUI :PlaySound (" Nav" )
232+ t_WeaponList = cat .list
233+ end
229234
230- if is_selected then
231- ImGui .SetItemDefaultFocus ()
232- end
235+ if is_selected then
236+ ImGui .SetItemDefaultFocus ()
233237 end
238+
239+ :: continue::
234240 end
235241 ImGui .EndCombo ()
236242 end
237243
238- if # t_WeaponList > 0 then
244+ if t_WeaponList and # t_WeaponList > 0 then
239245 ImGui .SameLine ()
240246
241- if ImGui .BeginCombo (" Weapon" , weapons .get_weapon_display_name (t_WeaponList [i_WeaponIndex ])) then
247+ local wpn_name = weapons .get_weapon_display_name (t_WeaponList [i_WeaponIndex ])
248+ if ImGui .BeginCombo (" Weapon" , wpn_name ) then
242249 for i , wpn in ipairs (t_WeaponList ) do
243250 local is_selected = (i_WeaponIndex == i )
244- local wpn_name = weapons .get_weapon_display_name (wpn )
245-
246251 if ImGui .Selectable (wpn_name , is_selected ) then
247252 i_WeaponIndex = i
248253 end
249254
250255 if GUI :IsItemClicked (0 ) then
251256 GUI :PlaySound (" Nav" )
252- i_SelectedBodyguardWeapon = joaat ( t_WeaponList [ i_WeaponIndex ])
257+ i_SelectedBodyguardWeapon = wpn
253258 end
254259
255260 if is_selected then
0 commit comments