- Documentation
- Server functions
- getPedSimplestTask
Function
getPedSimplestTask
Returns the name of the most recently set task (across all layers), i.e. what the ped is doing right now according to scripts. Returns false when the ped has no tasks.
Syntax
string getPedSimplestTask(ped ped)Arguments
pedped- A player or an NPC.
Returns
Task name, or false.
Example
outputServerLog(tostring(getPedSimplestTask(guard)))
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.isPedDoingTaskChecks whether any of a ped's task layers holds a task with the given name (stored bysetPedTaskor by functions such assetPedEnterVehicle, which storeenterVehicle).