# CFX::GET_ALL_PEDS

- **Hash:** `0xB8584FEF`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `GetAllPeds`
- **Side:** server (Cfx runtime native)
- **Name status:** official
- **Documentation:** described with examples
- **URL:** https://natives.borderlinerp.com/natives/CFX/GET_ALL_PEDS

## Signature

```c
object GET_ALL_PEDS();
```

## Returns

`object` — An object containing a list of peds handles.

## Description

*Source: Cfx.re native reference*

Returns all peds handles known to the server.
The data returned adheres to the following layout:

```
[127, 42, 13, 37]
```

## Usage

### Lua

```lua
local retval = GetAllPeds()

-- always available, by hash
local retval = Citizen.InvokeNative(0xb8584fef, Citizen.ResultAsObject2(msgpack.unpack))
```

### JavaScript

```js
const retval = GetAllPeds();

// by hash
const retval = Citizen.invokeNative('0xb8584fef', Citizen.returnResultAnyway(), Citizen.resultAsObject2());
```

### C#

```csharp
Function.Call((Hash)0xb8584fef);
```

## Examples

*Source: Cfx.re native reference*

```lua
-- 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
end
```

*Sources: Cfx.re native reference.*
