Log in to reply

How to use Task Sequence via Hashes?

  • I want to perform a certain task sequence to my ped via hashes (since it has a lot more options than doing AddTask.xxxx):

    InputArgument tasks_driver = new InputArgument(typeof(TaskSequence));
    Function.Call(Hash.OPEN_SEQUENCE_TASK, tasks_driver);
    Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, driverPed, driverVehicle, playerPos.X, playerPos.Y, playerPos.Z, 20f, 1f, driverVehicle.GetHashCode(), 1074528805, 1f, true);
    Function.Call(Hash.TASK_LEAVE_VEHICLE, driverPed, driverVehicle, 1);
    Function.Call(Hash.TASK_PERFORM_SEQUENCE, driverPed);

    This however generates an error in-game:

    [ERROR] Caught fatal unhandled exception:
    [ERROR] System.InvalidCastException: Unable to cast object of type 'System.RuntimeType' to native value
    [ERROR] at GTA.Native.FunctionObjectToNative(Object value)

    Any ideas?

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.