-- This example will prevent the closest vehicle from influencing the wanted level.
-- Retrieve the LocalPlayer
local playerPed = PlayerPedId()
-- Retrieve the coordinates of the player.
local playerCoords = GetEntityCoords(playerPed)
-- Retrieve the closest vehicle.
local vehicle = GetClosestVehicle(playerCoords.x, playerCoords.y, playerCoords.z, 3, 0, 70)
-- 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
-- Set the vehicle to not influence the wanted level.
SetVehicleInfluencesWantedLevel(vehicle, false)