Files

35 lines
1.0 KiB
Lua
Raw Permalink Normal View History

2025-05-04 00:12:32 +02:00
RegisterCommand("weapons", function(source)
local src = source
if IsPlayerAceAllowed(src, "weapon.menu") then
TriggerClientEvent("openWeaponMenu", src)
else
TriggerClientEvent('ox_lib:notify', src, {
title = 'Permission',
description = 'You don\'t have the permission to open this menu.',
type = 'error'
})
end
end, false)
RegisterServerEvent("weapons:giveWeapon")
AddEventHandler("weapons:giveWeapon", function(weapon, label)
local src = source
local success = exports.ox_inventory:AddItem(src, weapon, 1)
if success then
TriggerClientEvent('ox_lib:notify', src, {
title = 'Weapon Menu',
2025-05-04 00:18:28 +02:00
description = 'You received: ' .. label,
2025-05-04 00:12:32 +02:00
type = 'success'
})
else
TriggerClientEvent('ox_lib:notify', src, {
title = 'Weapon Menu',
2025-05-04 00:18:28 +02:00
description = 'Impossible to receive the weapon: ' .. label,
2025-05-04 00:12:32 +02:00
type = 'error'
})
end
2025-05-04 00:18:28 +02:00
end)