- Documentation
- Server functions
- setPedDriveTo
Function
setPedDriveTo
The NPC driver drives to a single point along the game's roads. onPedDriveFinished fires on arrival.
Syntax
bool setPedDriveTo(ped ped, vehicle vehicle, float x, float y, float z [, table options = nil])Arguments
pedped- The NPC.
vehiclevehicle- The vehicle.
xfloat- Target X.
yfloat- Target Y.
zfloat- Target Z.
optionstable, optional = nil- As in
setPedDriveRoute(withoutloop).
Returns
true when the drive started.
Example
setPedDriveTo(taxiDriver, taxi, 2495, -1665, 13.3, { speed = 60 })
See also
setPedDriveRouteThe NPC driver follows a list of points along the game's roads. The game's autopilot drives: it turns at junctions, avoids cars and waits at red lights.onPedDrivePointReachedfires after each point andonPedDriveFinishedafter the last one. If the driver's seat is free, the NPC is put into it.stopPedDrivingEnds a drive started withsetPedDriveRouteorsetPedDriveTo. The NPC stays at the wheel and the vehicle brakes.onPedDriveFinishedThe NPC driver reached the last route point (withoutloop) or the target ofsetPedDriveTo.