TaskVehicleMissionPedTarget
DocsTaskVehicleMissionPedTarget(ped, vehicle, pedTarget, missionType, speed, drivingStyle, radius, straightLineDist, DriveAgainstTraffic)Description
All parameters except ped, vehicle, pedTarget and speed are optional; with missionType being only those that require a target entity.
If you don't want to use a parameter; pass 0 for int parameters, and -1.0f for the remaining float parameters.
Parameters
| Name | Type | Description |
|---|---|---|
ped | Ped | The ped to be tasked. |
vehicle | Vehicle | The vehicles' entity handle. |
pedTarget | Ped | The target ped. |
missionType | int | The mission type (default is 0) (see [TaskVehicleMission](#\_0x659427E0EF36BCDE)). |
speed | float | The speed in m/s. |
drivingStyle | int | The driving style (default is 0) (see [SetDriveTaskDrivingStyle](#\_0xDACE1BE37D88AF67)). |
radius | float | The radius of when the task will be completed (default is -1.0f). |
straightLineDist | float | The distance before the vehicle will drive straight to the target (default is -1.0f). |
DriveAgainstTraffic | BOOL | Whether the vehicle should drive against traffic (default is false). |
Quick Snippet: Get Ped HandlepedpedTarget
pedpedTargetUse 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 Vehiclevehicle
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
voidThis native does not return a value.
Examples
Official
local vehicle_model = `adder`
RequestModel(vehicle_model)
repeat Wait(0) until HasModelLoaded(vehicle_model)
local ped = PlayerPedId()
local coords = GetEntityCoords(ped) - GetEntityForwardVector(ped) * 15.0
local vehicle = CreateVehicle(vehicle_model, coords.x, coords.y, coords.z, GetEntityHeading(ped), true, false)
-- Allow the game engine to clear the model from memory
SetModelAsNoLongerNeeded(vehicle_model)
local ped_model = `a_m_m_skater_01`
RequestModel(ped_model)
repeat Wait(0) until HasModelLoaded(ped_model)
local driver = CreatePedInsideVehicle(vehicle, 0, ped_model, -1, true, false)
-- Allow the game engine to clear the model from memory
SetModelAsNoLongerNeeded(ped_model)
TaskVehicleMissionPedTarget(driver, vehicle, ped, 8, 35.0, 786468, -1.0, -1.0, true)
-- Mission Type: Flee | Drive Style: DrivingModeAvoidVehiclesReckless
SetPedKeepTask(driver, true)