GetVehiclePedIsIn
Docslocal retval = GetVehiclePedIsIn(ped, lastVehicle)Description
Retrieves the vehicle the specified ped is currently in, or the last vehicle they were in.
Parameters
| Name | Type | Description |
|---|---|---|
ped | Ped | The target ped |
lastVehicle | BOOL | A boolean value where `false` represents the current vehicle the Ped is in, and `true` represents the last vehicle the Ped was in. |
Quick Snippet: Get Ped Handleped
pedUse this to get the player ped handle for this native.
-- Get the player's ped handle (client-side)
local ped = PlayerPedId()
print("Ped handle: " .. ped)
-- For a specific player's ped (server-side):
-- local targetPed = GetPlayerPed(source)Quick Snippet: Get Vehicle→ Vehicle
→ VehicleUse this to get the current vehicle handle for this native.
-- Get the vehicle the player is currently in
local ped = PlayerPedId()
local vehicle = GetVehiclePedIsIn(ped, false)
if vehicle ~= 0 then
print("Vehicle handle: " .. vehicle)
print("Model: " .. GetEntityModel(vehicle))
else
print("Player is not in a vehicle")
endVehicle Models

adder
alpha
blade
ardent
asea
cogcabrio
baller
blistaPed Models

mp_m_freemode_01
player_zero
ig_agatha
s_m_y_cop_01
s_m_m_gaffer_01
g_m_m_armboss_01
a_c_boar
a_m_m_bevhills_01Returns
VehicleReturns a vehicle handle.
Examples
Official
-- This example gets the vehicle the player is currently in and print the vehicle id.
-- Retrieve the LocalPlayer.
local playerPed = PlayerPedId()
-- Retrieve the vehicle the player is currently in.
local vehicle = GetVehiclePedIsIn(playerPed, false)
-- Check if the vehicle exists in the game world.
if not DoesEntityExist(vehicle) then
-- If the vehicle does not exist, end the execution of the code here.
return
end
-- Print the vehicle id
print("Vehicle ID: " .. vehicle)