- Documentation
- Server functions
- isPedDoingTask
Function
isPedDoingTask
Checks whether any of a ped's task layers holds a task with the given name (stored by setPedTask or by functions such as setPedEnterVehicle, which store enterVehicle).
Syntax
bool isPedDoingTask(ped ped, string taskName)Arguments
pedped- A player or an NPC.
taskNamestring- Task name, e.g.
"enterVehicle".
Returns
true when the ped has such a task.
Example
if isPedDoingTask(guard, "patrol") then return end
See also
setPedTaskStores a "task" for a ped in a chosen layer, e.g.primary="enterVehicle", together with any data. It is a mechanism for scripts (e.g. your own NPC AI): the game does not carry out stored tasks by itself, but other scripts can read them withgetPedTask,getPedTasks,isPedDoingTaskandgetPedSimplestTask. Passingnilas the name clears the task from the layer.getPedSimplestTaskReturns the name of the most recently set task (across all layers), i.e. what the ped is doing right now according to scripts. Returnsfalsewhen the ped has no tasks.