Citizen.CreateThread(function()
while ESX == nil do
Citizen.Wait(10)
end
while true do
Citizen.Wait(7)
if not IsPlayerDead(PlayerId()) then
DisableControlAction(0, 37, true)
if IsDisabledControlJustPressed(1, Config.OpenControl) and GetLastInputMethod(0) and inventorySearching == false then
openInventory()
TriggerEvent('PickupObject')
elseif IsDisabledControlJustReleased(1, Keys["1"]) and canFire then
if fastWeapons[1] ~= nil then
TriggerServerEvent("esx:useItem", fastWeapons[1])
end
elseif IsDisabledControlJustReleased(1, Keys["2"]) and canFire then
if fastWeapons[2] ~= nil then
TriggerServerEvent("esx:useItem", fastWeapons[2])
end
elseif IsDisabledControlJustReleased(1, Keys["3"]) and canFire then
if fastWeapons[3] ~= nil then
TriggerServerEvent("esx:useItem", fastWeapons[3])
end
elseif IsDisabledControlJustReleased(1, Keys["4"]) and canFire then
if fastWeapons[4] ~= nil then
TriggerServerEvent("esx:useItem", fastWeapons[4])
end
elseif IsDisabledControlJustReleased(1, Keys["5"]) and canFire then
if fastWeapons[5] ~= nil then
TriggerServerEvent("esx:useItem", fastWeapons[5])
end
elseif IsDisabledControlJustReleased(1, Keys ["TAB"]) then
showHotbar()
end
else
Citizen.Wait(1000)
end
end
end)