Vehicles natives
Vehicle work splits in two: the engine (drive) part and the body (enter/leave, seats, doors) part. Real driving AI in mods is not what you get from handing a ped a wheel; it's a choreographed stream of small native calls.
Driving to a point
TASK_VEHICLE_DRIVE_TO_COORD(driver, vehicle, x, y, z, speed, behaviour, drivingModel, drivingFlags, ...) — the workhorse. The flags in real code are the ones the game actually understands, not cool-sounding ones from lists that mislead:
Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD,
driver.Handle, vehicle.Handle, x, y, z, speed, 0, vehicle.Model.Hash, drivingFlags, 5f, 1f);
When you need it: the moment an NPC must arrive somewhere under its own wheel — a patrol rolling to the scene, a getaway after a fight. Flags control lane discipline, stopping at lights or not, and obeying traffic; they are not a "behave well" checkbox.
Entering and leaving
TASK_ENTER_VEHICLE(ped, vehicle, timeout, seat, speed, ...) sends a ped to a specific seat; TASK_LEAVE_VEHICLE(ped, vehicle, flags) gets them out.
When you need it: every transfer between foot and vehicle life — NPCs climbing into cruisers during a raid, suspects being led to a car for transport. Pick the seat deliberately (-1 for the driver, others by index); IS_VEHICLE_SEAT_FREE(vehicle, seat) tells you before you issue a doomed order.
Temporary actions
TASK_VEHICLE_TEMP_ACTION(ped, vehicle, action, timeMs) performs a short-lived maneuver — brake hard, drive slow, ram — without a full driving task behind it.
When you need it: response fading: the van that brakes at the checkpoint, the escort that slows to let the convoy pass. Short, bounded, and it ends by itself — the engine returns control cleanly when the time runs out.
What not to do
SET_INTO_VEHICLE/warp-teleporting an actor into a seat is a zero-contact teleport that snaps the ped through the doorframe — visible, immersion-breaking. Use it only before the actor is visible, and otherwise always enter via TASK_ENTER_VEHICLE so the ped does the honest walk-to-door-climb-in sequence. Never overwrite a driver's task mid-turn either: check the ped isn't driving before you re-order it.