From b541a1253d66630b59a2a5436efea7239aa5fc89 Mon Sep 17 00:00:00 2001 From: LightBlueCube <115393812+LightBlueCube@users.noreply.github.com> Date: Thu, 5 Sep 2024 06:55:44 +0800 Subject: [PATCH 1/2] fix crash when player got a special team --- .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index f7c398d97..81404657b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -1062,7 +1062,9 @@ void function OnPlayerChangedTeam( entity player ) if ( !player.hasConnected ) // Prevents players who just joined to trigger below code, as server always pre setups their teams return - NotifyClientsOfTeamChange( player, GetOtherTeam( player.GetTeam() ), player.GetTeam() ) + // only TEAM_IMC and TEAM_MILITIA can use function GetOtherTeam(), doesnt need to notify them when player got a special team + if( [ TEAM_IMC, TEAM_MILITIA ].contains( player.GetTeam() ) ) + NotifyClientsOfTeamChange( player, GetOtherTeam( player.GetTeam() ), player.GetTeam() ) foreach( npc in GetNPCArray() ) { From f4ea721d6d1db5f7d5beed7719ef2c8fe58dd69d Mon Sep 17 00:00:00 2001 From: LightBlueCube <115393812+LightBlueCube@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:04:50 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: William Miller --- .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 81404657b..5d3777b49 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -1063,7 +1063,7 @@ void function OnPlayerChangedTeam( entity player ) return // only TEAM_IMC and TEAM_MILITIA can use function GetOtherTeam(), doesnt need to notify them when player got a special team - if( [ TEAM_IMC, TEAM_MILITIA ].contains( player.GetTeam() ) ) + if( IsIMCOrMilitiaTeam( player.GetTeam() ) ) NotifyClientsOfTeamChange( player, GetOtherTeam( player.GetTeam() ), player.GetTeam() ) foreach( npc in GetNPCArray() )