Hi guys,
i'm currently fiddling with Game.Fibers, everything work so far ingame, the only thing is, i cannot End() the callout with the "end" key. I think its because i am "stuck" in the while loop, until the callout ends automatically within the procedure itself? i want to add "if (Game.IsKeyDown(Keys.End)) End();"
I tried everything, but it seems not to work within the while loop
- read comments please;)
Here is the code, please dont hate i'm a noob
public override void Process()
//...more code here...
else if (MainScenario > 60)
{
CalloutRunning2 = true;
while (CalloutRunning2)
{
//somewhere here i want to add the possibility to End() the callout with "if (Game.IsKeyDown(Keys.End)) End();" if possible?
// Wait until the player is within 30 units of the area
while (Game.LocalPlayer.Character.DistanceTo(area) >= 30)
{
GameFiber.Wait(0);
}
// Wait until the player exists and is within 10 units of the area
while (Game.LocalPlayer.Character.Exists() && Game.LocalPlayer.Character.DistanceTo(area) >= 10)
{
GameFiber.Yield();
}
if (Game.LocalPlayer.Character.Exists() && Game.LocalPlayer.Character.DistanceTo(area) < 10)
{
Game.DisplaySubtitle("~y~Search the area for the caller. (Wait a few seconds, callout ends automatically!");
// Wait a few seconds till callout ends
GameFiber.Wait(10000);
Game.DisplayNotification("~b~Player:~w~ Dispatch, Nothing found.");
GameFiber.Wait(500);
End(); //callout ends here automatically then (on purpose)
break;
}
}
CalloutRunning2 = false;
}
if (Functions.IsPedArrested(Suspect)) End();
if (Suspect.IsDead) End();
if (Game.LocalPlayer.Character.IsDead) End();
if (Game.IsKeyDown(Keys.End)) End(); // this only works in my first Mainscenario < 60
base.Process();
}
thanks,
totem