-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathserver.lua
37 lines (37 loc) · 1.65 KB
/
server.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if Config.Core == "ESX" then
for k, v in pairs(Config.Fireworks) do
if v.item then
ESX.RegisterUsableItem(v.item, function(source)
local xPlayer = ESX.GetPlayerFromId(source)
if Config.NeedLighter then
local isHaveLighter = xPlayer.getInventoryItem(Config.LighterItem).count
if isHaveLighter == 0 then
return TriggerClientEvent('vms_firework:notification', source, 'NEED_LIGHTER', 5000, 'error')
end
end
if v.itemRemovable then
xPlayer.removeInventoryItem(v.item, 1)
end
TriggerClientEvent('vms_firework:startFirework', source, k)
end)
end
end
elseif Config.Core == "QB-Core" then
for k, v in pairs(Config.Fireworks) do
if v.item then
QBCore.Functions.CreateUseableItem(v.item, function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if Config.NeedLighter then
local isHaveLighter = Player.Functions.GetItemByName(Config.LighterItem)
if isHaveLighter == nil or isHaveLighter.amount == 0 then
return TriggerClientEvent('vms_firework:notification', source, 'NEED_LIGHTER', 5000, 'error')
end
end
if v.itemRemovable then
Player.Functions.RemoveItem(v.item, 1, false)
end
TriggerClientEvent('vms_firework:startFirework', source, k)
end)
end
end
end