What's new

Script Help with policejob armory

Kerberos

Gold Elite
Joined
Jun 14, 2021
Messages
64
Reaction score
92
Points
221
Hi all.

I have a policejob with access true rank.
The script worked but i think i messed up something.
So, the deal is, every rank can see what is in the inventory, but only can take what is configured on your level.
The problem is, with different rank it says i can't take the item (that is ok), but with the correct rank, it says nothing but the weapon don't come to my inventory.
Here is the code:

ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'armory_get_weapon',
{
title = _U('get_weapon_menu'),
align = 'top-left',
elements = elements,
},
function(data, menu)
menu.close()
local arma = data.current.value

if (PlayerData.job.grade == 0) then
local flag = false
for i=1, #Config.ArmasPermitidas.Nivel1, 1 do
if (arma == Config.ArmasPermitidas.Nivel1.name) then
flag = true
ESX.TriggerServerCallback('esx_policejob:removeArmoryWeapon', function()
OpenGetWeaponMenu()
end, data.current.value)
end
end
if not flag then
ESX.ShowNotification("Não tens permissão para retirar uma/um " .. ESX.GetWeaponLabel(arma) .."!")
end
end


end,
function(data, menu)
menu.close()
end
)
end)
end


Can you help me ?
Thanks
 
Top