From 68d24e1cbed28eed27555a5332d351686dac2234 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Thu, 25 Oct 2018 20:36:34 -0400 Subject: [PATCH] Rewrote PUGpasscheck Added some stuff and a condition where it wont run constantly. Only when it needs to unless you want it to watch teams. --- autoexec/GetTeamCounts.cs | 6 +++-- autoexec/PUGpasscheck.cs | 56 ++++++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/autoexec/GetTeamCounts.cs b/autoexec/GetTeamCounts.cs index 4d46b6a..3781ca5 100644 --- a/autoexec/GetTeamCounts.cs +++ b/autoexec/GetTeamCounts.cs @@ -30,6 +30,10 @@ function GetTeamCounts( %game, %client, %respawn ) deactivatePackage(StartTeamCounts); } + //Check pug password + CheckPUGpassword(); + + //Get teamcounts if($GetCountsClientTeamChange && $countdownStarted && $MatchStarted) { //Team Count code by Keen $PlayerCount[0] = 0; @@ -79,8 +83,6 @@ function GetTeamCounts( %game, %client, %respawn ) } - //Check pug pass - CheckPUGpassword(); //Call itself again. Every 5 seconds. schedule(5000, 0, "GetTeamCounts"); diff --git a/autoexec/PUGpasscheck.cs b/autoexec/PUGpasscheck.cs index f219226..78eedd3 100644 --- a/autoexec/PUGpasscheck.cs +++ b/autoexec/PUGpasscheck.cs @@ -1,20 +1,58 @@ //To activate a password in certain gamemodes //called in Getcounts.cs +//and also other options like distance and speed +//turn tournament mode off when switched to lak + +// Variables +// Add these to ServerPrefs +// +// Turn on Auto Password at a player limit +// $Host::PUGautoPassword = 1; +// What value does Auto Password turn on +// $Host::PUGautoPasswordLimit = 10; +// The PUG password you want +// $Host::PUGPassword = "pickup"; + function CheckPUGpassword() { - if( $CurrentMissionType !$= "LakRabbit" ) { + //Only run before mission start and countdown start + if( !$MatchStarted && !$countdownStarted ) + { + if( $CurrentMissionType !$= "LakRabbit" ) + { + if( $Host::TournamentMode ) + $Host::Password = $Host::PUGPassword; - if( $Host::TournamentMode ) - $Host::Password = "pickup"; - else if( ($AllPlayerCount < 10) && !$Host::TournamentMode ) - $Host::Password = ""; + else if( !$Host::TournamentMode ) + { + $Host::Password = ""; + + //if 10 players are already on the server when the map changes + if( $TotalTeamPlayerCount >= $Host::PUGautoPasswordLimit && $Host::PUGautoPassword ) + $Host::Password = $Host::PUGPassword; + } - if($AllPlayerCount >= 10) { - $Host::Password = "pickup"; + $Host::HiVisibility = "0"; } - } - else if( $CurrentMissionType $= "LakRabbit" ) { + else if( $CurrentMissionType $= "LakRabbit" ) + { $Host::Password = ""; $Host::TournamentMode = 0; + + $Host::HiVisibility = "1"; + } + + //echo ("PUGpassCheck"); + } + + //If someone changes teams + else if( $Host::PUGautoPassword && $CurrentMissionType !$= "LakRabbit" && !$Host::TournamentMode ) + { + if( $TotalTeamPlayerCount < $Host::PUGautoPasswordLimit ) + $Host::Password = ""; + else if( $TotalTeamPlayerCount >= $Host::PUGautoPasswordLimit ) + $Host::Password = $Host::PUGPassword; + + //echo ("PUGpassCheckTeamchange"); } } \ No newline at end of file