From 19f0d89e2160d0c152cf127e6bb102d7f872777a Mon Sep 17 00:00:00 2001 From: x3Karma Date: Thu, 30 Dec 2021 14:33:01 +0800 Subject: Prevents setting last survivor again when new player connects --- Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Northstar.Custom/mod/scripts/vscripts/gamemodes') diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut index 2e3f03ad..a0e0b743 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut @@ -2,6 +2,7 @@ global function GamemodeInfection_Init struct { bool hasHadFirstInfection = false + bool hasHadLastInfection = false array playersToNotifyOfInfection } file @@ -70,7 +71,7 @@ void function InfectPlayer( entity player ) array survivors = GetPlayerArrayOfTeam( INFECTION_TEAM_SURVIVOR ) if ( survivors.len() == 0 ) SetWinner( INFECTION_TEAM_INFECTED ) - else if ( survivors.len() == 1 ) + else if ( survivors.len() == 1 && !file.hasHadLastInfection ) SetLastSurvivor( survivors[ 0 ] ) if ( !file.hasHadFirstInfection ) @@ -176,6 +177,8 @@ void function SetLastSurvivor( entity player ) if ( GameTime_TimeLeftSeconds() > 45 ) SetServerVar( "gameEndTime", Time() + 45.0 ) + + file.hasHadLastInfection = true } int function TimeoutCheckSurvivors() -- cgit v1.2.3