-- 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)