forked from Gregorsaur/ESX-Easy-Weapon-Accessories
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
38 lines (32 loc) · 1.27 KB
/
main.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
38
local ESX = nil
TriggerEvent('esx:getSharedObject', function( obj ) ESX = obj end)
ESX.RegisterUsableItem('suppressor', function( source )
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
TriggerClientEvent('eden_accesories:use', source, 'suppressor')
xPlayer.removeInventoryItem('suppressor', 1)
end)
ESX.RegisterUsableItem('flashlight', function( source )
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
TriggerClientEvent('eden_accesories:use', source, 'flashlight')
xPlayer.removeInventoryItem('flashlight', 1)
end)
ESX.RegisterUsableItem('grip', function( source )
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
TriggerClientEvent('eden_accesories:use', source, 'grip')
xPlayer.removeInventoryItem('grip', 1)
end)
ESX.RegisterUsableItem('yusuf', function( source )
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
TriggerClientEvent('eden_accesories:use', source, 'skin')
xPlayer.removeInventoryItem('yusuf', 1)
end)
RegisterServerEvent('eden_accesories:giveBack')
AddEventHandler('eden_accesories:giveBack', function(item)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.addInventoryItem(item, 1)
end)