- Documentation
- Server functions
- getPedTasks
Function
getPedTasks
Returns a table of all of a ped's task layers as "layer → task name". Useful to see what scripts told an NPC to do.
Syntax
table getPedTasks(ped ped)Arguments
pedped- A player or an NPC.
Returns
A table of layer → name.
Example
for layer, name in pairs(getPedTasks(guard)) do outputServerLog(layer .. ": " .. name) 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.getPedTaskReturns the task stored in a layer bysetPedTask: its name, data and the moment (ingetTickCountunits) it was set. Returnsfalsewhen the layer is empty.