Files
esx_core/modules/accessories/client/events.lua
T
2020-05-13 21:05:49 +02:00

40 lines
838 B
Lua

local self = ESX.Modules['accessories']
local Input = ESX.Modules['input']
AddEventHandler('esx_accessories:hasEnteredMarker', function(zone)
self.CurrentAction = 'shop_menu'
self.CurrentActionMsg = _U('press_access')
self.CurrentActionData = { accessory = zone }
end)
AddEventHandler('esx_accessories:hasExitedMarker', function(zone)
ESX.UI.Menu.CloseAll()
self.CurrentAction = nil
end)
-- Key Controls
Input.On('released', Input.Groups.MOVE, Input.Controls.PICKUP, function(lastPressed)
if self.CurrentAction and (not ESX.IsDead) then
self.CurrentAction()
self.CurrentAction = nil
end
end)
if self.Config.EnableControls then
Input.On('released', Input.Groups.MOVE, Input.Controls.REPLAY_SHOWHOTKEY, function(lastPressed)
if not ESX.IsDead then
self.OpenAccessoryMenu()
end
end)
end