- Documentation
- Server functions
- getPedDriveState
Function
getPedDriveState
Returns the NPC's driving state and the index of the current route point.
Syntax
string, int getPedDriveState(ped ped)Arguments
pedped- The NPC.
Returns
"driving", "stopped" (a stopAt stop), "arrived" (end of the route) or "blocked" (standing for over 8 s outside a stop: traffic, a red light, a blocked road) and the point index; false if the NPC is not driving.
Example
local state, index = getPedDriveState(driver)
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.onPedDriveBlockedThe NPC driver has been standing for over 8 s outside a stop (traffic, a red light, a player blocking the road). It fires every 8 s until the vehicle moves.