From 464825cb304b070fb0d497f47a3e8a8d831d5248 Mon Sep 17 00:00:00 2001 From: Maya Date: Tue, 29 Mar 2022 00:53:06 +0200 Subject: Fix Game Crash when player not in capperArray (#279) --- .../mod/scripts/vscripts/gamemodes/_gamemode_cp.nut | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Northstar.CustomServers/mod') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 74e6b58c..705b7836 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -150,8 +150,8 @@ void function GamemodeCP_OnPlayerKilled(entity victim, entity attacker, var dama void function removePlayerFromCapperArray_threaded(array capperArray,entity player) { WaitFrame() - if(capperArray.contains(player)) - capperArray.remove(capperArray.find(player)) + FindAndRemove(capperArray,player) + } void function RateSpawnpoints_CP( int checkClass, array spawnpoints, int team, entity player ) @@ -589,12 +589,12 @@ void function HardpointThink( HardpointStruct hardpoint ) foreach(entity player in hardpoint.imcCappers) { if(DistanceSqr(player.GetOrigin(),hardpointEnt.GetOrigin())>1200000) - hardpoint.imcCappers.remove(hardpoint.imcCappers.find(player)) + FindAndRemove(hardpoint.imcCappers,player) } foreach(entity player in hardpoint.militiaCappers) { if(DistanceSqr(player.GetOrigin(),hardpointEnt.GetOrigin())>1200000) - hardpoint.militiaCappers.remove(hardpoint.militiaCappers.find(player)) + FindAndRemove(hardpoint.militiaCappers,player) } @@ -656,7 +656,7 @@ void function OnHardpointLeft( entity trigger, entity player ) hardpoint = hardpointStruct if ( player.GetTeam() == TEAM_IMC ) - hardpoint.imcCappers.remove( hardpoint.imcCappers.find( player ) ) + FindAndRemove( hardpoint.imcCappers, player ) else FindAndRemove( hardpoint.militiaCappers, player ) foreach(CP_PlayerStruct playerStruct in file.players) @@ -702,4 +702,4 @@ string function GetHardpointGroup(entity hardpoint) //Hardpoint Entity B on Home return "B" return string(hardpoint.kv.hardpointGroup) -} \ No newline at end of file +} -- cgit v1.2.3