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.
This commit is contained in:
ChocoTaco 2018-10-25 20:36:34 -04:00
parent 1648d12e0f
commit 68d24e1cbe
2 changed files with 51 additions and 11 deletions

View file

@ -30,6 +30,10 @@ function GetTeamCounts( %game, %client, %respawn )
deactivatePackage(StartTeamCounts); deactivatePackage(StartTeamCounts);
} }
//Check pug password
CheckPUGpassword();
//Get teamcounts
if($GetCountsClientTeamChange && $countdownStarted && $MatchStarted) { if($GetCountsClientTeamChange && $countdownStarted && $MatchStarted) {
//Team Count code by Keen //Team Count code by Keen
$PlayerCount[0] = 0; $PlayerCount[0] = 0;
@ -79,8 +83,6 @@ function GetTeamCounts( %game, %client, %respawn )
} }
//Check pug pass
CheckPUGpassword();
//Call itself again. Every 5 seconds. //Call itself again. Every 5 seconds.
schedule(5000, 0, "GetTeamCounts"); schedule(5000, 0, "GetTeamCounts");

View file

@ -1,20 +1,58 @@
//To activate a password in certain gamemodes //To activate a password in certain gamemodes
//called in Getcounts.cs //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() 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 ) else if( !$Host::TournamentMode )
$Host::Password = "pickup"; {
else if( ($AllPlayerCount < 10) && !$Host::TournamentMode ) $Host::Password = "";
$Host::Password = "";
if($AllPlayerCount >= 10) { //if 10 players are already on the server when the map changes
$Host::Password = "pickup"; if( $TotalTeamPlayerCount >= $Host::PUGautoPasswordLimit && $Host::PUGautoPassword )
$Host::Password = $Host::PUGPassword;
}
$Host::HiVisibility = "0";
} }
} else if( $CurrentMissionType $= "LakRabbit" )
else if( $CurrentMissionType $= "LakRabbit" ) { {
$Host::Password = ""; $Host::Password = "";
$Host::TournamentMode = 0; $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");
} }
} }