diff --git a/client/main.lua b/client/main.lua index bfe25dfd..68cce371 100644 --- a/client/main.lua +++ b/client/main.lua @@ -10,9 +10,10 @@ local Keys = { ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } -ESX = nil -local GUI = {} -GUI.Time = 0 +ESX = nil +local GUI = {} +local isDead = false +GUI.Time = 0 Citizen.CreateThread(function() while ESX == nil do @@ -64,9 +65,17 @@ end Citizen.CreateThread(function() while true do Citizen.Wait(25) - if IsControlPressed(0, Keys["F7"]) and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'billing') and (GetGameTimer() - GUI.Time) > 150 then + if IsControlPressed(0, Keys["F7"]) and not isDead and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'billing') and (GetGameTimer() - GUI.Time) > 150 then ShowBillsMenu() GUI.Time = GetGameTimer() end end end) + +AddEventHandler('esx:onPlayerDeath', function() + isDead = true +end) + +AddEventHandler('playerSpawned', function(spawn) + isDead = false +end)