From 358b243fe65cd319fb871c331fb359437ad1d395 Mon Sep 17 00:00:00 2001 From: Will Castro <39478251+VITALISED@users.noreply.github.com> Date: Fri, 14 Jan 2022 15:00:47 +1100 Subject: Fixes --- .../mod/scripts/vscripts/gamemodes/_gamemode_ps.nut | 9 ++++++--- .../mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut index cb11618a..9551e1cd 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ps.nut @@ -33,11 +33,14 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() || GetGameState() != eGameState.Playing ) AddTeamScore( attacker.GetTeam(), 1 ) - var existingAttackers = [] - foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory ) + table alreadyAssisted + foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory ) { - if( attackerInfo.attacker != attacker && !( attackerInfo.attacker in existingAttackers ) ) + if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] ) + { + alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 ) + } } } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut index ae5cb5e6..5aab3bf3 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_tdm.nut @@ -13,11 +13,14 @@ void function GiveScoreForPlayerKill( entity victim, entity attacker, var damage if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() || GetGameState() != eGameState.Playing ) AddTeamScore( attacker.GetTeam(), 1 ) - var existingAttackers = [] - foreach( DamageHistoryStruct attackerInfo in victim.e.recentDamageHistory ) + table alreadyAssisted + foreach( DamageHistoryStruct attackerInfo in player.e.recentDamageHistory ) { - if( attackerInfo.attacker != attacker && !( attackerInfo.attacker in existingAttackers ) ) + if( attackerInfo.attacker != attacker && !alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] ) + { + alreadyAssisted[attackerInfo.attacker.GetEncodedEHandle()] <- true attackerInfo.attacker.AddToPlayerGameStat( PGS_ASSISTS, 1 ) + } } } -- cgit v1.2.3