i wanted to ask if there is a good method, to wait for something until a event (Task) finishes.
For example : A Ped drives somewhere but after he finished this given event, he does something else.
I know, checking it periodically is capable of doing this, but i wanted to ask if there is a better method.
Thank you for reading !
I use RagePluginHook as a reference but the code should be the same:
if (!IsTask4Done && Game.LocalPlayer.Character.Position.DistanceTo(Pris3) <= 8)
Game.DisplayHelp("Press ~b~T~w~ to speak with ~r~Prisoner~w~", 6000);
Game.DisplaySubtitle("~b~You~w~: HANDS UP, THIS IS THE POLICE!", 4000);
int c = new Random().Next(1, 3);
if (c == 1)
Game.DisplaySubtitle("~r~Prisoner~w~: Congratulations, you just won the golden prize...a battle against the one and only " + suspect3Persona.Forename);
Game.DisplaySubtitle("~r~Prisoner~w~: Catch me if you can!");
Pris3.Tasks.Flee(Game.LocalPlayer.Character, 5000, -1);
IsTask4Done = true;
if (IsTask4Done == true && Game.LocalPlayer.Character.Position.DistanceTo(Pris3)<=8)
//now task him something else or you could continue in the !IsTask4Done method
Pris3.Tasks.DriveToPosition(Game.LocalPlayer.Character.CurrentVehicle, Pris2.Position, 25);