Skip to content

Commit

Permalink
👥 [v1.1.3] Add control playerLoad
Browse files Browse the repository at this point in the history
  • Loading branch information
imkuroneko authored Apr 20, 2024
1 parent 9083ffb commit 1a3966b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
19 changes: 17 additions & 2 deletions client.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local QBCore = exports['qb-core']:GetCoreObject()
lib.locale()
local defconMenu = {}
PlayerLoaded = false

-- ===== Armar estructura del menú
defconMenu = {
Expand Down Expand Up @@ -40,7 +41,7 @@ lib.registerContext(defconMenu)
RegisterNetEvent('neko_alertas_defcon:client:open_menu')
AddEventHandler('neko_alertas_defcon:client:open_menu', function()
QBCore.Functions.GetPlayerData(function(PlayerData)
if PlayerData.job.name ~= 'police' then
if PlayerData.job.type ~= 'leo' then
lib.notify({ description = locale('player_not_police') , type = 'error' })
else
if not PlayerData.job.onduty then
Expand All @@ -55,5 +56,19 @@ end)
-- ===== Enviar el evento de estado al cliente de los jugadores
RegisterNetEvent('neko_alertas_defcon:client:set_current_status')
AddEventHandler('neko_alertas_defcon:client:set_current_status', function(data)
SendNUIMessage({ alert = data.status })
if PlayerLoaded then
SendNUIMessage({ alert = data.status })
else
SendNUIMessage({ alert = 'g' })
end
end)



RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
PlayerLoaded = true
end)

RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
PlayerLoaded = false
end)
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lua54 'yes'
description 'Sistemas de alertas (DEFCON) para la policía'
author 'KuroNeko'
-- ===========================================================
version '1.1.2'
version '1.1.3'

-- ===========================================================
shared_scripts { '@ox_lib/init.lua' }
Expand Down
1 change: 1 addition & 0 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ end)
AddEventHandler('onResourceStart', function(resourceName)
if GetCurrentResourceName() ~= resourceName then return end
DefconCurrentStatus = GetLatestStatus()
print("^5El script ha cargado exitosamente")
end)

-- ===== Funciones
Expand Down

0 comments on commit 1a3966b

Please sign in to comment.