GetScriptTaskStatus
Docslocal retval = GetScriptTaskStatus(ped, taskHash)Description
Gets the status of a spesifed script-assigned task on the given ped. The return value is always an int between 0-7.
You can set taskHash to SCRIPT_TASK_ANY to check if any task is active, it will return 1 for active, 3 for no active.SCRIPT_TASK_INVALID can be similarly used, it returns 7 if there are any active task, and 3 if there are no active tasks.
taskHash list: https://alloc8or.re/gta5/doc/enums/eScriptTaskHash.txt
Returns:
0 = WAITING_TO_START_TASK
1 = PERFORMING_TASK
2 = DORMANT_TASK
3 = VACANT_STAGE
7 = TASK_FINISHED_OR_NOT_FOUNDParameters
| Name | Type | Description |
|---|---|---|
ped | Ped | The ped the task is running on |
taskHash | Hash | The hash of the task |
Quick Snippet: Get Ped Handleped
pedUse this to get the player ped handle for this native.
-- Get the player's ped handle (client-side)
local ped = PlayerPedId()
print("Ped handle: " .. ped)
-- For a specific player's ped (server-side):
-- local targetPed = GetPlayerPed(source)Ped Models

mp_m_freemode_01
player_zero
ig_agatha
s_m_y_cop_01
s_m_m_gaffer_01
g_m_m_armboss_01
a_c_boar
a_m_m_bevhills_01Returns
intReturns an integer value.
Examples
Official
local playerPed = PlayerPedId()
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 6.0, 0.0)
TaskGoStraightToCoord(playerPed, coords, 1.0, 5000, GetEntityHeading(playerPed), 0.15)
Citizen.CreateThread(function()
while true do
local taskStatus = GetScriptTaskStatus(PlayerPedId(), "SCRIPT_TASK_GO_STRAIGHT_TO_COORD")
print(taskStatus)
if taskStatus == 7 then print("task was finished!"); break end
Citizen.Wait(250)
end
end)