Skip to main content

PedGetModelId

This function was added in DSL 5

Description

Gets the model ID of a given ped.

This should be a valid ped handle, typically obtained from functions like PedGetTargetPed or PedIsValid.

warning

Passing a value other than number (string, boolean, table, function, etc...) will always return 0 as model ID.

But if you pass numbers that do not correspond to any valid ped (3.14 math.pi, -9999, etc...), it will throw an error.

function PedGetModelId(ped) --[[ ... ]] end

Parameters

  • ped: integer - The ped whose model ID you want to retrieve.

Return Values

  • modelId: integer - The model ID of the specified ped.

Example

local target = PedGetTargetPed(gPlayer)
if PedIsValid(target) then
print("Target Ped Model ID: " .. PedGetModelId(target))
end

See Also