public Hash GetTask(int pos) { if (tasks.Count > pos) { TaskNTimeTwo b = tasks[pos]; return(b.Task); } return(tasks[tasks.Count - 1].Task); }
public int GetEndTime() { if (GetPendingTasks() > 0) { TaskNTimeTwo t = tasks[0]; return(t.HowLong + t.StartTime); } else { return(-1); } }
public int GetTimeLeft(int pos) { if (tasks.Count > pos) { TaskNTimeTwo b = tasks[pos]; if (b.StartTime != -1 && b.HowLong != -1) { return(b.HowLong - (Game.GameTime - b.StartTime)); } return(-1); } return(-1); }
public void PerformTick() { if (GetPendingTasks() > 0) { TaskNTimeTwo t = tasks[0]; if (ArgsNow == null || TaskNow != t.Task || ArgsNow != t.Args) { TaskNow = t.Task; ArgsNow = t.Args; List <InputArgument> InArgs = new List <InputArgument>(); foreach (object o in t.Args) { InArgs.Add(new InputArgument(o)); } OutputArgument Sequence = new OutputArgument(); Function.Call(Hash.OPEN_SEQUENCE_TASK, Sequence); int SeqID = Sequence.GetResult <int>(); Function.Call(Hash.CLEAR_PED_TASKS_IMMEDIATELY, 0); Function.Call(t.Task, InArgs.ToArray()); Function.Call(Hash.TASK_STAND_STILL, 0, 2000); Function.Call(Hash.CLOSE_SEQUENCE_TASK, SeqID); Function.Call(Hash.TASK_PERFORM_SEQUENCE, ped, SeqID); Function.Call(Hash.CLEAR_SEQUENCE_TASK, Sequence); SequenceNow = SeqID; //UI.Notify("Performing " + t.Task); t.StartTime = Game.GameTime; } int Prog = Function.Call <int>(Hash.GET_SEQUENCE_PROGRESS, ped); int RunningTime = Game.GameTime - t.StartTime; if ((GetRemainingTime() != -1 && GetRemainingTime() <= 0) || (t.HowLong == -1 && Prog == 2 && RunningTime >= 2000)) { tasks.RemoveAt(0); TaskNow = Hash.WAIT; ArgsNow = null; } } else { //UI.ShowSubtitle("Progress: No Task"); Function.Call(Hash.CLEAR_PED_TASKS, ped); } int Progress = Function.Call <int>(Hash.GET_SEQUENCE_PROGRESS, ped); //UI.ShowSubtitle(tasks.Count + " Progress: " + Progress); }