ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
client

GetVehiclePedIsIn

FiveM client native documentation with a Lua example.

Summary

Returns the vehicle a ped is currently in (or the last vehicle). Returns 0 if none.

Returns

Vehicle (number) — the vehicle handle, or 0.

Parameters

pednumberThe ped handle.
lastVehiclebooleanIf true, returns the last vehicle the ped was in.

Example

local ped = PlayerPedId()
local veh = GetVehiclePedIsIn(ped, false)
if veh ~= 0 then
  -- player is in a vehicle
end

Common pitfalls

  • Returns 0 when the ped is on foot — always check for 0 before using the handle.
  • Pass false for the current vehicle; true gives the last one they were in.

Related natives

Related guides

FiveM scripts done right

Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.

Browse Scripts →