chore(example): Add more function examples; add information to readme

This commit is contained in:
Linden
2021-07-12 18:28:27 +10:00
parent 090965fd8a
commit 8c2e390c37
3 changed files with 95 additions and 13 deletions
+31 -3
View File
@@ -10,8 +10,6 @@ AddEventHandler('esx:playerLogout', function(xPlayer, isNew)
ESX.PlayerData = {}
end)
-- These two functions can perform the same task
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
@@ -40,4 +38,34 @@ OnPlayerData = function(key, val, last)
end
end
end
-----------------------------------------------
-----------------------------------------------
RegisterCommand('closestobject', function()
local result = ESX.Game.GetClosestObject(GetEntityCoords(PlayerPedId()))
print(result)
end)
RegisterCommand('closestped', function()
local result = ESX.Game.GetClosestPed(GetEntityCoords(PlayerPedId()))
print(result)
end)
RegisterCommand('closestplayer', function()
local result = ESX.Game.GetClosestPlayer(GetEntityCoords(PlayerPedId()))
print(result)
end)
RegisterCommand('closestvehicle', function()
local result = ESX.Game.GetClosestVehicle(GetEntityCoords(PlayerPedId()))
print(result)
end)
RegisterCommand('areaplayer', function()
local result = ESX.Game.GetPlayersInArea(GetEntityCoords(PlayerPedId()), 20)
print(json.encode(result))
end)
RegisterCommand('areavehicle', function()
local result = ESX.Game.GetVehiclesInArea(GetEntityCoords(PlayerPedId()), 20)
print(json.encode(result))
end)