mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 08:13:21 +00:00
improvements(boilerplate): Rename; add extra information and examples
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
RegisterNetEvent('esx:playerLoaded') -- When a player loads in, we can store some basic information about them locally
|
||||
AddEventHandler('esx:playerLoaded', function(playerId, xPlayer, isNew)
|
||||
ESX.Players[playerId] = xPlayer.job.name
|
||||
end)
|
||||
|
||||
AddEventHandler('esx:playerDropped', function(playerId, reason) -- Remove the data once the player no longer exists
|
||||
ESX.Players[playerId] = nil
|
||||
end)
|
||||
|
||||
AddEventHandler('onResourceStart', function(resourceName) -- The resource just restarted so we actually have a fresh copy of ESX.Players from the framework
|
||||
if (GetCurrentResourceName() == resourceName) then
|
||||
for playerId, xPlayer in pairs(ESX.Players) do
|
||||
print( ('%s %s is online with player id %s'):format(xPlayer.job.grade_label, xPlayer.name, playerId) )
|
||||
end
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user