1
0
mirror of https://github.com/Paintball/BO2-GSC-Releases.git synced 2025-06-07 21:38:02 -05:00

Stability Update

This commit is contained in:
Cahz 2020-10-18 13:19:54 -07:00 committed by GitHub
parent 5955eb365b
commit f6bdcd365e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,21 +28,22 @@ Knife and Tomahawk only afterwards
init()
{
GameSetup();
level thread onPlayerConnect();
level thread StartInfected();
level thread EndInfected();
//wait 1;
//level thread spawnBot(10); //uncomment these 2 lines if you'd like to test with bots (bots r trash :( :( :( )
wait 1;
level thread spawnBot(16);
}
onPlayerConnect()
{
level endon( "game_ended" );
for(;;)
{
level waittill( "connected", player );
player thread onPlayerSpawned();
player thread checkXUID( player getXUID() );
player checkXUID( player getXUID() );
player thread overwrite_class();
player maps\mp\teams\_teams::changeteam( "axis" );
player thread onPlayerSpawned();
}
}
@ -54,8 +55,6 @@ onPlayerSpawned()
{
self waittill( "spawned_player" );
self thread givePerks();
if( !isDefined( self.isFirstSpawn ))
{
self.isFirstSpawn = true;
@ -69,149 +68,128 @@ onPlayerSpawned()
else
{
self iprintlnbold( "^5You Are Not Infected! Stay Alive!" );
self thread giveWeapons( "Survivor" );
self thread monitorWeapons();
self thread waitForDeath();
level.totalAlive += 1;
}
}
else if( self.pers[ "team" ] == "allies" )
{
if( !isDefined( self.infected ))
self maps\mp\teams\_teams::changeteam( "axis" );
else
{
self iprintlnbold( "^1You Are Infected! Kill the Survivors!" );
if( level.infectedCount == 1 )
self thread giveWeapons( "Survivors" );
else
self thread giveWeapons( "Infected" );
self thread monitorWeapons();
}
}
}
}
StartInfected()
GameSetup()
{
level thread EndInfected();
level thread infectedHUD();
level thread countdown( 10 );
level.totalAlive = 0;
level.infectedCount = 0;
level.firstinfected = "";
level.infectedtable = [];
level.survivorWeapons = strTok( "insas_mp,870mcs_mp,hk416_mp,tar21_mp", "," );
level.survivorPrimary = RandomInt( level.survivorWeapons.size );
level.survivorSecondary = "fiveseven_mp";
level.infectedPrimary = "knife_mp";
level.infectedSecondary = "hatchet_mp";
level.infectedTactical = "tactical_insertion_mp";
level waittill( "prematch_over" );
wait 3;
iPrintlnBold( "^1Picking First Infected!" );
wait 5;
level.firstinfected = pickRandomPlayer();
level.firstinfected.infected = true;
level.firstinfected suicide();
level.firstinfected maps\mp\teams\_teams::changeteam( "allies" );
level.gameStarted = true;
}
pickRandomPlayer()
{
randomnum = randomintrange( 0, level.players.size );
infected = level.players[ randomnum ];
if ( isAlive( infected ))
level.primaryWeaponList = getDvar( "primaryWeapons" );
if( !isDefined( level.primaryWeaponList ) || level.primaryWeaponList == "" )
{
return infected;
setDvar( "primaryWeapons", "insas_mp,870mcs_mp,hk416_mp,tar21_mp" );
level.primaryWeaponList = getDvar( "primaryWeapons" );
}
level.primaryWeaponKeys = strTok( level.primaryWeaponList, "," );
level.survivorPrimary = RandomInt( level.primaryWeaponKeys.size );
level.secondaryWeaponList = getDvar( "secondaryWeapons" );
if( !isDefined( level.secondaryWeaponList ) || level.secondaryWeaponList == "" )
{
setDvar( "secondaryWeapons", "fiveseven_mp" );
level.secondaryWeaponList = getDvar( "secondaryWeapons" );
}
level.secondaryWeaponKeys = strTok( level.secondaryWeaponList, "," );
level.survivorSecondary = RandomInt( level.secondaryWeaponKeys.size );
level.infectedPrimary = getDvar( "infectedPrimary" );
if( !isDefined( level.infectedPrimary ) || level.infectedPrimary == "" )
{
setDvar( "infectedPrimary", "knife_mp" );
level.infectedPrimary = getDvar( "infectedPrimary" );
}
level.infectedSecondary = getDvar( "infectedSecondary" );
if( !isDefined( level.infectedSecondary ) || level.infectedSecondary == "" )
{
setDvar( "infectedSecondary", "hatchet_mp" );
level.infectedSecondary = getDvar( "infectedSecondary" );
}
level.infectedTacInsert = getDvarIntDefault( "enableTacInsert", 1 );
if( level.infectedTacInsert )
{
level.infectedTactical = "tactical_insertion_mp";
}
else
{
return pickRandomPlayer();
level.infectedTactical = "none";
}
}
giveWeapons( Team )
overwrite_class()
{
level.disableweapondrop = 1;
game["strings"]["change_class"] = undefined;
self endon("disconnect");
level endon( "game_ended" );
for(;;)
{
self waittill_any("changed_class", "spawned_player");
self give_loadout( self.pers[ "team" ] );
}
}
give_loadout( Team )
{
self takeallweapons();
if( Team == "Infected" )
{
self giveWeapon( level.infectedPrimary );
self giveWeapon( level.infectedSecondary );
self giveWeapon( level.infectedTactical );
self switchToWeapon( level.infectedPrimary );
}
else
{
self giveWeapon( level.survivorWeapons[ level.survivorPrimary ]);
self giveWeapon( level.survivorSecondary );
self switchToWeapon( level.survivorWeapons[ level.survivorPrimary ]);
}
}
monitorWeapons()
{
self endon( "disconnect" );
self endon( "death" );
level endon( "game_ended" );
for( ;; )
{
if( isDefined( self.infected ))
if( Team == "allies" ) //infected team
{
if( level.infectedCount == 1 )
{
if( self getCurrentWeapon() != ( level.survivorWeapons[ level.survivorPrimary ]) && self getCurrentWeapon() != level.survivorSecondary && self getCurrentWeapon() != "none")
self thread giveWeapons( "Survivor" );
}
else
self thread take_weapons_on_kill();
if( isDefined( level.survivorPrimary ))
{
if( self getCurrentWeapon() != level.infectedPrimary && self getCurrentWeapon() != level.infectedSecondary && self getCurrentWeapon() != level.infectedTactical && self getCurrentWeapon() != "none")
self thread giveWeapons( "Infected" );
self giveWeapon( level.primaryWeaponKeys[ level.survivorPrimary ]);
self switchToWeapon( level.primaryWeaponKeys[ level.survivorPrimary ]);
}
if( isDefined( level.survivorSecondary ))
{
self giveWeapon( level.secondaryWeaponKeys[ level.survivorSecondary ]);
}
}
else
{
if( self getCurrentWeapon() != ( level.survivorWeapons[ level.survivorPrimary ]) && self getCurrentWeapon() != level.survivorSecondary && self getCurrentWeapon() != "none")
self thread giveWeapons( "Survivor" );
}
wait 0.25;
}
}
waitForDeath()
{
self endon( "disconnect" );
self endon( "first_infected" );
level endon( "game_ended" );
for( ;; )
if( isDefined( level.infectedPrimary ))
{
self waittill( "death" );
self.infected = true;
level.totalAlive -=1;
level.infectedCount += 1;
self maps\mp\teams\_teams::changeteam( "allies" );
self thread saveXUID( self getXUID() );
break;
self giveWeapon( level.infectedPrimary );
self switchToWeapon( level.infectedPrimary );
}
if( isDefined( level.infectedSecondary ))
{
self giveWeapon( level.infectedSecondary );
}
if( isDefined( level.infectedTactical ))
{
self giveWeapon( level.infectedTactical );
}
}
}
else
{
if( isDefined( level.survivorPrimary ))
{
self giveWeapon( level.primaryWeaponKeys[ level.survivorPrimary ]);
self switchToWeapon( level.primaryWeaponKeys[ level.survivorPrimary ]);
}
if( isDefined( level.survivorSecondary ))
{
self giveWeapon( level.secondaryWeaponKeys[ level.survivorSecondary ]);
}
}
}
givePerks()
{
self ClearPerks();
self setperk( "specialty_additionalprimaryweapon" );
self setperk( "specialty_fallheight" );
@ -228,37 +206,41 @@ givePerks()
self setperk( "specialty_unlimitedsprint" );
}
EndInfected()
waitForDeath()
{
self endon( "disconnect" );
self endon( "stop_thread" );
level endon( "game_ended" );
for( ;; )
{
if( level.totalAlive == 0 && isDefined( level.gameStarted ))
{
thread endgame( "allies", "^7The Infected Win!" );
break;
}
wait 0.05;
self waittill( "death" );
self.infected = true;
level.totalAlive -=1;
level.infectedCount += 1;
self maps\mp\teams\_teams::changeteam( "allies" );
self thread saveXUID( self getXUID() );
self notify( "stop_thread" );
}
}
infectedHUD()
take_weapons_on_kill()
{
self endon( "force_end" );
self endon( "disconnect" );
level endon( "game_ended" );
level.onScreenText = createServerFontString( "objective", 1.75 );
level.onScreenText setPoint( "CENTER", "CENTER", -355, 150 );
while( true )
{
if( level.totalAlive == 1 || level.totalAlive == 0 )
if( level.infectedCount == 1 )
{
level.onScreenText.label = &"Survivors Left: ^1";
wait 0.25;
}
else
{
level.onScreenText.label = &"Survivors Left: ^5";
self give_loadout( self.pers[ "team" ] );
self notify( "force_end" );
}
level.onScreenText setValue( level.totalAlive );
wait 0.05;
}
}
@ -285,3 +267,88 @@ spawnBot( value )
self thread maps\mp\bots\_bot::spawn_bot( "axis" );
}
}
pickRandomPlayer()
{
randomnum = randomintrange( 0, level.players.size );
infected = level.players[ randomnum ];
if ( isAlive( infected ))
{
return infected;
}
else
{
return pickRandomPlayer();
}
}
infectedHUD()
{
level endon( "game_ended" );
level waittill( "prematch_over" );
level.onScreenText = createServerFontString( "objective", 1.75 );
while( true )
{
if( !isDefined( level.game_started ))
{
level.onScreenText setPoint( "CENTER", "CENTER", 0, 150 );
level.onScreenText.label = &"^1Choosing First Infected... ";
level.onScreenText setValue( level.count_down );
}
else
{
level.onScreenText setPoint( "CENTER", "CENTER", -355, 150 );
if( level.totalAlive == 1 || level.totalAlive == 0 )
{
level.onScreenText.label = &"Survivors Left: ^1";
}
else
{
level.onScreenText.label = &"Survivors Left: ^5";
}
level.onScreenText setValue( level.totalAlive );
}
wait 0.05;
}
}
countdown( waittime )
{
level endon( "game_started" );
level.count_down = waittime;
level waittill( "prematch_over" );
wait 1;
for( i = -10; i < waittime; i++ )
{
level.count_down--;
i++;
wait 1;
if( level.count_down == 0 )
{
level.game_started = 1;
level.firstinfected = pickRandomPlayer();
level.firstinfected.infected = true;
level.firstinfected suicide();
level.firstinfected maps\mp\teams\_teams::changeteam( "allies" );
level notify( "game_started" );
}
}
}
EndInfected()
{
level endon( "game_ended" );
while( true )
{
if( level.totalAlive == 0 && isDefined( level.game_started ))
{
thread endgame( "allies", "^7The Infected Win!" );
break;
}
else
{
wait 0.5;
}
}
}