SomeoneHasSkill - Accessed None 'Pawn' fix

This commit is contained in:
Shtoyan 2022-01-20 21:19:11 +04:00
parent 7af1e7bc4e
commit 65371a7a53

View File

@ -50,24 +50,35 @@ static function bool HasSkill(NicePlayerController nicePlayer, class<NiceSkill>
return true;
return false;
}
static function bool SomeoneHasSkill(NicePlayerController player, class<NiceSkill> skill){
static function bool SomeoneHasSkill(NicePlayerController player, class<NiceSkill> skill)
{
local int i;
local Controller P;
local NicePlayerController nicePlayer;
if (player == none)
return false;
if(player.Pawn.Role == ROLE_Authority)
for(P = player.Level.ControllerList; P != none; P = P.nextController){
// added pawn check coz of log spam
if (player.Pawn != none && player.Pawn.Role == ROLE_Authority)
{
for(P = player.Level.ControllerList; P != none; P = P.nextController)
{
nicePlayer = NicePlayerController(P);
if (nicePlayer != none && HasSkill(nicePlayer, skill) && nicePlayer.Pawn.Health > 0 && !nicePlayer.Pawn.bPendingDelete
&& nicePlayer.PlayerReplicationInfo.Team == player.PlayerReplicationInfo.Team)
return true;
}
else for(i = 0;i < player.broadcastedSkills.Length;i ++)
}
else
{
for (i = 0;i < player.broadcastedSkills.Length;i ++)
if (player.broadcastedSkills[i] == skill)
return true;
}
return false;
}
// Checks if player will automatically chose given skill at the next opportunity
static function bool IsSkillPending(NicePlayerController nicePlayer, class<NiceSkill> skill){
local int i;