diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2024-01-04 00:26:31 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 01:26:31 +0100 |
commit | 44505833b1fb686c614e75d8269f23f0bc3173c4 (patch) | |
tree | 816a82a4332f73c1c666dd5c7ff728c2456c08a7 /Northstar.Custom/mod/scripts/vscripts | |
parent | 0e153649396355f8d726bad233992725633edea6 (diff) | |
download | NorthstarMods-44505833b1fb686c614e75d8269f23f0bc3173c4.tar.gz NorthstarMods-44505833b1fb686c614e75d8269f23f0bc3173c4.zip |
Prevent crash when selecting first infected (#731)
End match early if there are no players when trying to select infected
Diffstat (limited to 'Northstar.Custom/mod/scripts/vscripts')
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut index fef4c8b6..c7175e74 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_inf.gnut @@ -45,6 +45,15 @@ void function SelectFirstInfectedDelayed() wait 10.0 + RandomFloat( 5.0 )
array<entity> players = GetPlayerArray()
+
+ // End game if server empty on selecting infected
+ if ( !players.len() )
+ {
+ printt( "Couldn't select first infected: player array was empty" )
+ SetWinner( INFECTION_TEAM_SURVIVOR )
+ return
+ }
+
entity infected = players[ RandomInt( players.len() ) ]
InfectPlayer( infected )
|