Skip to content

Commit 440fa83

Browse files
authored
Update menu.lua
1 parent f422411 commit 440fa83

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

client/menu.lua

+10-18
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ local menuOptions = {
6868
}
6969

7070
for _, weaponInfo in ipairs(weaponOptions) do
71-
table.insert(menuOptions, {label = weaponInfo.label, icon = 'gun', args = {id = weaponInfo.label}})
71+
table.insert(menuOptions, {label = weaponInfo.label, icon = 'gun', args = {id = weaponInfo.label, model = weaponInfo.model}})
7272
end
7373

7474
lib.registerMenu({
@@ -82,20 +82,12 @@ lib.registerMenu({
8282

8383
if not input then return end
8484
local weaponModel = input[1]
85-
86-
-- Check if the input weapon name matches any model in the array
87-
for _, weaponInfo in ipairs(weaponOptions) do
88-
if weaponModel == weaponInfo.label then
89-
giveWeapon(weaponInfo.model)
90-
return
91-
end
92-
end
93-
94-
print('Invalid weapon name:', weaponModel)
85+
giveWeapon(weaponModel)
86+
else
87+
giveWeapon(args.model)
9588
end
9689
end)
9790

98-
9991
lib.registerMenu({
10092
id = 'zaps-rd-server',
10193
title = 'Server Options',
@@ -321,30 +313,30 @@ function clearpedtask()
321313
end
322314

323315
function giveWeapon(weaponModel)
324-
local playerPed = PlayerId()
316+
local playerPed = PlayerPedId()
325317

326318
if playerPed ~= -1 then
327-
local weaponHash = GetHashKey(weaponModel)
319+
local weaponHash = joaat(weaponModel)
328320

329-
if weaponHash == 0 then
321+
if weaponHash == 0 then
330322
lib.notify({
331323
title = 'RedM | Trainer',
332-
333324
description = 'Invalid Weapon',
334325
type = 'error'
335326
})
336327
else
337-
GiveWeaponToPed(GetPlayerPed(-1), weaponHash, 999, false, false)
328+
Citizen.InvokeNative(0x5E3BDDBCB83F3D84, playerPed, weaponHash, 999, true, false, 0, false, 0, 0, 0, false, 0.0, false) -- GiveWeaponToPed
329+
338330
lib.notify({
339331
title = 'RedM | Trainer',
340-
341332
description = "You received a " .. weaponModel,
342333
type = 'info'
343334
})
344335
end
345336
end
346337
end
347338

339+
348340
function clipboard()
349341
local ped = PlayerPedId()
350342
local curCoords = GetEntityCoords(ped)

0 commit comments

Comments
 (0)