This function retrieves a list of all players currently present in the game.
Parameters
onlyOtherPlayers (optional): If set to true, only other players (excluding the local player) will be included in the list. Default is false.
returnKeyValue (optional): If set to true, the function will return a table with player IDs as keys and their corresponding ped entities as values. Default is false.
returnPeds (optional): If set to true, the function will return a table of ped entities instead of player IDs. Default is false.
Return Value
players: A table containing either player IDs, ped entities, or key-value pairs of player ID and ped entity, based on the provided parameters.
This function retrieves a list of players present in a specific area.
Parameters
coords: The coordinates of the center point of the area.
maxDistance: The maximum distance from the center point to include players in the list.
onlyOtherPlayers (optional): If set to true, only other players (excluding the local player) will be included in the list. Default is false.
Return Value
A table containing player IDs or key-value pairs of player ID and ped entity, depending on the returnKeyValue parameter passed to Helper.Functions.GetPlayers().
local number = 3.14159
local rounded = Helper.Math.Round(number, 2)
print(rounded) -- Output: 3.14
local number = 1234567
local formatted = Helper.Math.GroupDigits(number)
print(formatted) -- Output: "1,234,567"
local str = " Hello, World! "
local trimmed = Helper.Math.Trim(str)
print(trimmed) -- Output: "Hello, World!"
local vehicles = Helper.Functions.GetVehicles()
for _, vehicle in ipairs(vehicles) do
-- Do something with each vehicle entity
-- DeleteEntity(vehicle)
end
local players = Helper.Functions.GetPlayers()
for _, player in ipairs(players) do
-- Do something with each player ID
end
local players = Helper.Functions.GetPlayers(true, false, true)
for _, ped in pairs(players) do
-- Do something with each ped entity
end
local areaCoords = vector3(0, 0, 0)
local maxDistance = 100
local playersInArea = Helper.Functions.GetPlayersInArea(areaCoords, maxDistance)
for _, player in ipairs(playersInArea) do
-- Do something with each player ID in the area
end
local areaCoords = vector3(0, 0, 0)
local maxDistance = 100
local vehiclesInArea = Helper.Functions.GetVehiclesInArea(areaCoords, maxDistance)
for _, vehicle in ipairs(vehiclesInArea) do
-- Do something with each vehicle entity in the area
end
local spawnCoords = vector3(0, 0, 0)
local maxDistance = 5
local isClear = Helper.Functions.IsSpawnPointClear(spawnCoords, maxDistance)
if isClear then
-- Proceed with spawning logic
else
-- Choose a different spawn point
end
local myTable = {a = 1, b = 2, c = 3}
Helper.Table.ForEach(myTable, function(key, value)
print(key, value)
end)