@@ -68,7 +68,7 @@ local menuOptions = {
68
68
}
69
69
70
70
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 }})
72
72
end
73
73
74
74
lib .registerMenu ({
@@ -82,20 +82,12 @@ lib.registerMenu({
82
82
83
83
if not input then return end
84
84
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 )
95
88
end
96
89
end )
97
90
98
-
99
91
lib .registerMenu ({
100
92
id = ' zaps-rd-server' ,
101
93
title = ' Server Options' ,
@@ -321,30 +313,30 @@ function clearpedtask()
321
313
end
322
314
323
315
function giveWeapon (weaponModel )
324
- local playerPed = PlayerId ()
316
+ local playerPed = PlayerPedId ()
325
317
326
318
if playerPed ~= - 1 then
327
- local weaponHash = GetHashKey (weaponModel )
319
+ local weaponHash = joaat (weaponModel )
328
320
329
- if weaponHash == 0 then
321
+ if weaponHash == 0 then
330
322
lib .notify ({
331
323
title = ' RedM | Trainer' ,
332
-
333
324
description = ' Invalid Weapon' ,
334
325
type = ' error'
335
326
})
336
327
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
+
338
330
lib .notify ({
339
331
title = ' RedM | Trainer' ,
340
-
341
332
description = " You received a " .. weaponModel ,
342
333
type = ' info'
343
334
})
344
335
end
345
336
end
346
337
end
347
338
339
+
348
340
function clipboard ()
349
341
local ped = PlayerPedId ()
350
342
local curCoords = GetEntityCoords (ped )
0 commit comments