GET_PLAYER_PED
Used to get the player's Ped Entity ID when a valid playerSrc is passed.
Signature
Entity GET_PLAYER_PED(char* playerSrc);Parameters
| Name | Type | Description |
|---|---|---|
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
Used to get the player's Ped Entity ID when a valid playerSrc is passed.
Usage
local retval = GetPlayerPed(playerSrc)
-- always works, by hash
local retval = Citizen.InvokeNative(0x6e31e993, playerSrc, Citizen.ResultAsInteger())JavaScript and C#
const retval = GetPlayerPed(playerSrc);
// by hash
const retval = Citizen.invokeNative('0x6e31e993', playerSrc, Citizen.returnResultAnyway(), Citizen.resultAsInteger());int retval = Function.Call<int>((Hash)0x6e31e993, playerSrc);Examples
-- 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!
endSources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.