Good Evening one and all, Another one for y'all to ponder...
if (this.IsPrankCall)
{
DelayedCaller.Call(
delegate
{
// Tell control it was a prank
Functions.PlaySound("EMERG_PRANK_CALL", true, false);
Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END"), 5000);
Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END_TW"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL"));
this.End();
},
this,
10000);
this.State = EShootoutState.Prank;
}
else
{
Log.Info("WAITING FOR SPOT", this);
bool playerHasBeenSpotted = false;
bool randomFight = Common.GetRandomBool(0, 300, 1);
// Check whether player has been spotted
foreach (LPed criminal in this.criminals)
{
Log.Info("LOOP THROUGH CRIMINALSx", this);
if (criminal.Exists())
{
Log.Info("CRIMINAL EXISTS", this);
if (criminal.HasSpottedPed(LPlayer.LocalPlayer.Ped, false))
{
Log.Info("POLICE SPOTTED", this);
playerHasBeenSpotted = true;
break;
}
}
}
Log.Info("IF SPOTTED", this);
// If player has been spotted
if (playerHasBeenSpotted || randomFight)
{
this.State = EShootoutState.Fighting;
this.Engage();
Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_FIGHT_SUSPECTS"), 5000);
}
}
With regards to the above section of code, I've placed a number of Log.Info's to trace the crash, if the call turns out to be a prank, then it works fine and Ends however if not, and it ends up in the latter ELSE statement, the last log I get is "CRIMINAL EXISTS" which would leave me to believe that that the "HasSpottedPed" is causing a crash...any ideas why?! Mainly aimed at LMS tbh, as you're the most likely to understand the function :) Thanks! J