mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
refactor(modules/npwd): format code
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
local npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil
|
||||
|
||||
AddEventHandler('onServerResourceStart', function(resource)
|
||||
if resource ~= 'npwd' then
|
||||
return
|
||||
end
|
||||
if resource ~= 'npwd' then
|
||||
return
|
||||
end
|
||||
|
||||
npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil
|
||||
npwd = GetResourceState('npwd'):find('start') and exports.npwd or nil
|
||||
|
||||
for _, xPlayer in pairs(ESX.Players) do
|
||||
npwd:newPlayer({
|
||||
source = xPlayer.source,
|
||||
identifier = xPlayer.identifier,
|
||||
firstname = xPlayer.get('firstName'),
|
||||
lastname = xPlayer.get('lastName')
|
||||
})
|
||||
end
|
||||
for _, xPlayer in pairs(ESX.Players) do
|
||||
npwd:newPlayer({
|
||||
source = xPlayer.source,
|
||||
identifier = xPlayer.identifier,
|
||||
firstname = xPlayer.get('firstName'),
|
||||
lastname = xPlayer.get('lastName')
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('onServerResourceStop', function(resource)
|
||||
if resource == 'npwd' then
|
||||
npwd = nil
|
||||
end
|
||||
if resource == 'npwd' then
|
||||
npwd = nil
|
||||
end
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
|
||||
if not npwd then
|
||||
return
|
||||
end
|
||||
if not npwd then
|
||||
return
|
||||
end
|
||||
|
||||
if not xPlayer then
|
||||
xPlayer = ESX.GetPlayerFromId(playerId)
|
||||
@@ -41,9 +41,9 @@ AddEventHandler('esx:playerLoaded', function(playerId, xPlayer)
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:playerLogout', function(playerId)
|
||||
if not npwd then
|
||||
return
|
||||
end
|
||||
if not npwd then
|
||||
return
|
||||
end
|
||||
|
||||
npwd:unloadPlayer(playerId)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user