求助,代碼有3組錯誤搞了幾天都搞不好

yauling112

普通用户
10
0
1
1.)
AIVehicleController.cs
private Vehicle GetSuspectVehicle()
{
// Get the suspect's vehicle from the pursuit
foreach (Ped suspect in Functions.GetPursuitPeds(_pursuit))
{
if (suspect != null && suspect.Exists() && suspect.IsInVehicle)
{
return suspect.CurrentVehicle;
}
}
return null;
}
運算子 '&&' 不可套用至類型為 'bool' 和 '方法群組' 的運算元


2.)
private List<Vehicle> GetPursuitCopVehicles(LHandle pursuit)
{
List<Vehicle> vehicles = new List<Vehicle>();
foreach (Ped cop in Functions.GetPursuitCops(pursuit))
{
if (cop != null && cop.Exists() && cop.IsInVehicle && !cop.IsPlayer)
{
vehicles.Add(cop.CurrentVehicle);
}
}
return vehicles;
}
運算子 '&&' 不可套用至類型為 'bool' 和 '方法群組' 的運算元


3.)
private static void CheckPursuitStatus()
{
// 獲取當前所有的追捕 - 使用替代方法
var currentPursuits = new List<LHandle>();
var allPeds = World.GetAllPeds();

foreach (Ped ped in allPeds)
{
if (ped != null && ped.Exists() && Functions.IsPedInPursuit(ped))
{
LHandle pursuit = Functions.GetPursuitOfPed(ped);
if (!currentPursuits.Contains(pursuit))
{
currentPursuits.Add(pursuit);
}
}
}

// 檢查新追捕
foreach (var pursuit in currentPursuits)
{
if (!_activePursuits.Contains(pursuit))
{
OnPursuitStarted(pursuit);
_activePursuits.Add(pursuit);
}
}

// 檢查已結束的追捕
foreach (var pursuit in new HashSet<LHandle>(_activePursuits))
{
bool isStillRunning = false;
foreach (Ped ped in Functions.GetPursuitPeds(pursuit))
{
if (ped != null && ped.Exists() && Functions.IsPedInPursuit(ped))
{
isStillRunning = true;
break;
}
}

if (!isStillRunning)
{
OnPursuitEnded(pursuit);
_activePursuits.Remove(pursuit);
}
}
}
'Functions' 未包含 'GetPursuitOfPed' 的定義
 

附件

  • SmartPursuit.txt
    4.3 KB · 查看: 0
  • AIVehicleController.txt
    7.1 KB · 查看: 0
  • PursuitManager.txt
    5.8 KB · 查看: 0