# CFX::GET_PLAYER_PED

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

## Signature

```c
Entity GET_PLAYER_PED(char* playerSrc);
```

## Parameters

- `playerSrc` (`char*`) — The player source, passed as a string.

## Returns

`Entity` — Returns a valid Ped Entity ID if the passed `playerSrc` is valid, `0` if not.

## Description

*Source: Cfx.re native reference*

Used to get the player's Ped Entity ID when a valid `playerSrc` is passed.

## Usage

### Lua

```lua
local retval = GetPlayerPed(playerSrc)

-- always available, by hash
local retval = Citizen.InvokeNative(0x6e31e993, playerSrc, Citizen.ResultAsInteger())
```

### JavaScript

```js
const retval = GetPlayerPed(playerSrc);

// by hash
const retval = Citizen.invokeNative('0x6e31e993', playerSrc, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
```

### C#

```csharp
int retval = Function.Call<int>((Hash)0x6e31e993, playerSrc);
```

## Examples

*Source: Cfx.re native reference*

```lua
-- Let's assume source is a valid ID
local pedId = GetPlayerPed(source);

-- If pedId is valid (not equal to 0)
if pedId ~= 0 then
    -- Do something with this ped!
end
```

*Sources: Cfx.re native reference.*
