FiveM Docs / Native Reference
API Set:
  • all
  • server
  • client
Language:
  • raw
  • lua
  • c#
  • js
Namespace: TASKAPI set: clientGame: gta5editImprove

OPEN_SEQUENCE_TASK

0xE8854A4326B9E12B
0xABA6923E
// OpenSequenceTask
void OPEN_SEQUENCE_TASK(int* taskSequenceId);
Parameters:
  • taskSequenceId:

    The reference to bind to, in Lua/JS this will be returned as a value

NOTE

If this returns 0 that means it failed to get a sequence id.

If you fail to call CLOSE_SEQUENCE_TASK and CLEAR_SEQUENCE_TASK the sequence system can get stuck in a broken state until you restart your client.

Examples:

  • Lua
  • C#
Citizen.CreateThread(function()
    local animDict = 'timetable@ron@ig_5_p3'

    RequestAnimDict(animDict)
    while not HasAnimDictLoaded(animDict) do
        Wait(0)
    end

    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)

    -- you can change the model, but you might have to change the offsets below.
    local objModelHash = `prop_bench_01a`

    local obj = GetClosestObjectOfType(pos.x, pos.y, pos.z, 5.0, objModelHash, false, false, false)
    if obj == 0 then
        print("No valid object within range!")
        return
    end

    local tgtPos = GetOffsetFromEntityInWorldCoords(obj, 0.0, -0.7, 0.0)

    -- open the task sequence so we can get our sequence id
    local sequence = OpenSequenceTask()

    -- set our desired heading to be the same as the objects
    local desiredHeading = GetEntityHeading(obj) - 180.0

    -- go to the entities offset
    TaskGoStraightToCoord(nil, tgtPos.x, tgtPos.y, tgtPos.z, 1.0, 4000, desiredHeading, 1.0)

    -- sit on the bench indefinitely (you can change -1 here to however long you want to sit)
    TaskPlayAnim(nil, animDict, 'ig_5_p3_base', 8.0, 8.0, -1, 1)

    -- close the sequence so we can perform it
    CloseSequenceTask(sequence)

    -- perform the sequence, this will not work if the sequence is still open.
    TaskPerformSequence(ped, sequence)

    -- free the sequence slot so it can be re-used
    ClearSequenceTask(sequence)

    -- cleanup the animation dict so the engine can remove it when its no longer needed
    RemoveAnimDict(animDict)
end)
Privacy
•
Cookie Policy
•
Cookie Settings
IS_MOVE_BLEND_RATIO_SPRINTING(Ped ped)
IS_MOVE_BLEND_RATIO_STILL(Ped ped)
IS_MOVE_BLEND_RATIO_WALKING(Ped ped)
IS_PED_ACTIVE_IN_SCENARIO(Ped ped)
IS_PED_BEING_ARRESTED(Ped ped)
IS_PED_CUFFED(Ped ped)
IS_PED_GETTING_UP(Ped ped)
IS_PED_IN_WRITHE(Ped ped)
IS_PED_PLAYING_BASE_CLIP_IN_SCENARIO(Ped ped)
IS_PED_RUNNING(Ped ped)
IS_PED_RUNNING_ARREST_TASK(Ped ped)
IS_PED_SPRINTING(Ped ped)
IS_PED_STILL(Ped ped)
IS_PED_STRAFING(Ped ped)
IS_PED_WALKING(Ped ped)
IS_PLAYING_PHONE_GESTURE_ANIM(Ped ped)
IS_SCENARIO_GROUP_ENABLED(char* scenarioGroup)
IS_SCENARIO_OCCUPIED(float p0, float p1, float p2, float p3, BOOL p4)
IS_SCENARIO_TYPE_ENABLED(char* scenarioType)
IS_TASK_MOVE_NETWORK_ACTIVE(Ped ped)
IS_TASK_MOVE_NETWORK_READY_FOR_TRANSITION(Ped ped)
IS_WAYPOINT_PLAYBACK_GOING_ON_FOR_PED(Any p0)
IS_WAYPOINT_PLAYBACK_GOING_ON_FOR_VEHICLE(Vehicle vehicle)
OPEN_PATROL_ROUTE(char* patrolRoute)
OPEN_SEQUENCE_TASK(int* taskSequenceId)
PED_HAS_USE_SCENARIO_TASK(Ped ped)
PLAY_ANIM_ON_RUNNING_SCENARIO(Ped ped, char* animDict, char* animName)
PLAY_ENTITY_SCRIPTED_ANIM(Any p0, Any* p1, Any* p2, Any* p3, float p4, float p5)
REMOVE_ALL_COVER_BLOCKING_AREAS()
REMOVE_COVER_POINT(ScrHandle coverpoint)
REMOVE_WAYPOINT_RECORDING(char* name)
REQUEST_TASK_MOVE_NETWORK_STATE_TRANSITION(Ped ped, char* name)
REQUEST_WAYPOINT_RECORDING(char* name)
RESET_EXCLUSIVE_SCENARIO_GROUP()
RESET_SCENARIO_GROUPS_ENABLED()