Don't show register menu if dead

This commit is contained in:
ElPumpo
2018-12-13 21:11:56 +01:00
parent 91954ae025
commit c94f6c45cd
+13 -1
View File
@@ -2,6 +2,8 @@ local guiEnabled = false
local myIdentity = {}
local myIdentifiers = {}
local hasIdentity = false
local isDead = false
ESX = nil
Citizen.CreateThread(function()
@@ -11,6 +13,14 @@ Citizen.CreateThread(function()
end
end)
AddEventHandler('esx:onPlayerDeath', function(data)
isDead = true
end)
AddEventHandler('playerSpawned', function(spawn)
isDead = false
end)
function EnableGui(state)
SetNuiFocus(state, state)
guiEnabled = state
@@ -23,7 +33,9 @@ end
RegisterNetEvent('esx_identity:showRegisterIdentity')
AddEventHandler('esx_identity:showRegisterIdentity', function()
EnableGui(true)
if not isDead then
EnableGui(true)
end
end)
RegisterNetEvent('esx_identity:identityCheck')