GET_ALL_PEDS
Returns all peds handles known to the server.
Signature
object GET_ALL_PEDS();Returns object — An object containing a list of peds handles.
Description
Returns all peds handles known to the server. The data returned adheres to the following layout:
[127, 42, 13, 37]Usage
local retval = GetAllPeds()
-- always works, by hash
local retval = Citizen.InvokeNative(0xb8584fef, Citizen.ResultAsObject2(msgpack.unpack))JavaScript and C#
const retval = GetAllPeds();
// by hash
const retval = Citizen.invokeNative('0xb8584fef', Citizen.returnResultAnyway(), Citizen.resultAsObject2());Function.Call((Hash)0xb8584fef);Examples
-- This example prints information of every ped that has an owner.
for i, ped in ipairs(GetAllPeds()) do
local pedOwner = NetworkGetEntityOwner(ped)
if pedOwner > 0 then
local playerName = GetPlayerName(pedOwner)
local pedModel = GetEntityModel(ped)
local pedArmour = GetPedArmour(ped)
print("Ped : "..ped.." | Owner name : "..playerName.." | Model : "..pedModel.." | Armour : "..pedArmour)
end
endSources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.