- Documentation
- Server functions
- setPedHornState
Function
setPedHornState
Turns the NPC driver's horn on or off. Players nearby hear it. Works while driving with setPedDriveRoute or setPedDriveTo.
Syntax
bool setPedHornState(ped ped, bool state)Arguments
pedped- The NPC.
statebooltruehonks,falsestops.
Returns
true on success; false if the NPC is not driving.
Example
addEventHandler("onPedDriveBlocked", driver, function()
setPedHornState(source, true)
setTimer(setPedHornState, 1500, 1, source, false)
end)
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.