LOADING MODZ
THIS IS VARY ANNOYING I KNOW SO JOIN OR LOG IN, IT TAKES LIKE 2 SECONDS <3 Shadow Ghost and Loading

Protect the President

Go down

Protect the President

Post by 3LIT3 Loading on Mon Oct 31, 2011 12:07 am

Code:

#include common_scripts\utility;
#include maps\mp\_utility;

#include maps\mp\gametypes\_hud_util;
#include maps\custom\_utility;


init()
{
   thread onPlayerConnect();
   thread onPlayerConnected();
   thread spawnExtractionPoint();
   thread assignTeams();
   thread worldVariables();
   thread gametypeDvars();
   thread displayTime();
   thread soundEffect();
}
   
onPlayerConnect()
{
   for(;;)
   {
      level waittill( "connecting", player );

      player thread onPlayerSpawned();
      player thread onPlayerKilled();
      player thread playerVariables();
      player thread notifyPlayer();
      player thread outOfTime();
   }
}

onPlayerConnected()
{
   for(;;)
   {
      level waittill( "connected", player );

      player thread extraction();
      player thread inGameStatus();
      player thread setupGame();
      player thread scrollingText();
      player thread openMenu();
   }
}

onPlayerSpawned()
{
   for(;;)
   {
      self waittill( "spawned_player" );

      if( self._ptp["team"] == "president" )
      {
         if( self.pers["team"] == "allies" )
         {
            self thread equipPresident();
         }
         else if( self.pers["team"] != "allies" )
         {
            self._ptp["team"] = "president";
            self [[level.allies]]();
         }
      }
      else if( self._ptp["team"] == "security" )
      {
         if( self.pers["team"] == "allies" )
         {
            self thread equipSecurity();
         }
         else if( self.pers["team"] != "allies" )
         {
            self._ptp["team"] = "security";
            self [[level.allies]]();
         }
      }
      else if( self._ptp["team"] == "terrorists" )
      {
         if( self.pers["team"] == "axis" )
         {
            self thread equipTerrorists();
         }
         else if( self.pers["team"] != "axis" )
         {
            self._ptp["team"] = "terrorists";
            self [[level.axis]]();
         }
      }
      else if( self._ptp["team"] == "spectator" )
      {
         if( self.pers["team"] != "spectator" )
         {
            self._ptp["team"] = "spectator";
            self [[level.spectator]]();
         }
      }
   }
}

onPlayerKilled()
{
   level waittill( "matchHasBegun" );

   for(;;)
   {
      self waittill( "killedPlayer", eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon );

      if( self._ptp["team"] == "president" )
      {
         wait 0.2;

         thread maps\mp\gametypes\_globallogic::endGame( "axis", "The president has been killed" );
      }
      else if( self._ptp["team"] == ( "security" || "terrorists" ) )
      {
         self._ptp["team"] = "spectator";
         self [[level.spectator]]();
      }      
   }
}

extraction()
{
   level endon( "map_restarting" );
   level endon( "game_over" );

   level waittill( "matchHasBegun" );

   wait 1.0;

   if( self._ptp["team"] != "president" ) return;

   for(;;)
   {
      distance = 250;
      extractionTime = 5; // In seconds
      time = " seconds remaining";

      wait 0.05;

      if( distance( self.origin, level._ptp["extractionPoint"] ) < distance )
      {
         progress = createPrimaryProgressBar( 25 );
         text = createPrimaryProgressBarText( 25 );

         timeLeft = extractionTime;

         while( timeLeft > 0 && distance( self.origin, level._ptp["extractionPoint"] ) < distance )
         {
            wait 0.05;

            timeLeft-=0.05;

            text setText( extractionTime + time );
            progress updateBar( timeLeft / 5 );
         }

         if( timeLeft <= 0 && distance( self.origin, level._ptp["extractionPoint"] ) < distance )
         {
            text destroyElem();
            progress destroyElem();

            wait 0.2;

            thread maps\mp\gametypes\_globallogic::endGame( "allies", "The president has been extracted" );

            level notify( "game_over" );
         }
         else
         {
            text destroyElem();
            progress destroyElem();
         }
      }
   }
}

notifyPlayer()
{
   level endon( "map_restarting" );

   for(;;)
   {
      self waittill( "spawned_player" );

      notifyData = "";

      if( self._ptp["team"] == "president" )
      {
         notifyData = spawnStruct();
         notifyData.titleText = "You are the president!";
         notifyData.notifyText = "Make it to the extraction point";
      }
      else if( self._ptp["team"] == "security" )
      {
         notifyData = spawnStruct();
         notifyData.titleText = "You are security!";
         notifyData.notifyText = "Protect the president";
      }
      else if( self._ptp["team"] == "terrorists" )
      {
         notifyData = spawnStruct();
         notifyData.titleText = "You are a terrorist!";
         notifyData.notifyText = "Kill the president";
      }

      self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
   }
   
}

equipPresident()
{
   weapons = "makarov_mp";

   weaponsList = strTok( weapons, "," );

   self takeAllWeapons();
   self clearPerks();
   self giveWeapon( "knife_mp" );

   for( i = 0; i < weaponsList.size; i++ )
   {
      wait 0.10;

      self giveWeapon( weaponsList[i] );
      self giveMaxAmmo( weaponsList[i] );
   }

   self switchToWeapon( weaponsList[0] );
}

equipSecurity()
{
   weapons = "famas_extclip_mp,enfield_extclip_mp";

   weaponsList = strTok( weapons, "," );

   self takeAllWeapons();
   self clearPerks();
   self giveWeapon( "knife_mp" );

   for( i = 0; i < weaponsList.size; i++ )
   {
      wait 0.10;

      self giveWeapon( weaponsList[i] );
      self giveMaxAmmo( weaponsList[i] );
   }

   self switchToWeapon( weaponsList[0] );
}

equipTerrorists()
{
   weapons = "ak47_silencer_mp,m16_silencer_mp,wa2000_silencer_mp";

   weaponsList = strTok( weapons, "," );

   self takeAllWeapons();
   self clearPerks();
   self giveWeapon( "knife_mp" );

   for( i = 0; i < weaponsList.size; i++ )
   {
      wait 0.10;

      self giveWeapon( weaponsList[i] );
      self giveMaxAmmo( weaponsList[i] );
   }

   self switchToWeapon( weaponsList[0] );
}

displayTime()
{
   self endon( "missionAccomplished" );

   total_time = 2; // Game time in minutes

   element = createServerFontString( "objective", 1.50 );
   element defineElement( ( 1, 1, 1 ), false, "center", "bottom", 0, -40, 1, 1 );

   text = "^7Nuke expected to explode in: ";
   time = " ^7minutes";

   for( i = total_time; i > 1; i-- )
   {
      element setText( text + i + time );

      wait 60;
   }

   time = " ^7seconds";

   for( i = 60; i > 0; i-- )
   {
      wait 1;

      element setText( text + i + time );
   }

   level notify( "missionFailed" );

   element fadeOverTime( 2.0 );
   element.alpha = 0;

   wait 2.0;

   element destroy();
}

outOfTime()
{
   self endon( "missionAccomplished" );
   level endon( "map_restarting" );

   level waittill( "missionFailed" );

   shader = newClientHudElem( self );
   shader defineElement( ( 1, 1, 1 ), false, "fullscreen", "fullscreen", 0, 0, 0, 1 );
   shader setShader( "white", 640, 480 );

   shader fadeOverTime( 0.8 );
   shader.alpha = 1;
   
   wait 0.8;

   shader fadeOverTime( 0.5 );
   shader.alpha = 0;

   wait randomFloatRange( 0.00, 1.50 );

   self finishPlayerDamage( level, level, 100, 400, "MOD_EXPLOSIVE", "destructible_car_mp", ( 0, 0, 0 ), self._vec2, 0.2, 0, 0, "none", 0 );
}


soundEffect()
{
   level endon( "missionAccomplished" );
   level endon( "map_restarting" );

   level waittill( "missionFailed" );

   playSoundAtPosition( "amb_end_nuke", level._ptp["extractionPoint"] );
}

gametypeDvars()
{
   setDvar( "g_TeamName_Allies", "^2U.S. Officials" );
   setDvar( "g_TeamName_Axis", "^1Terrorists" );
   setDvar( "scr_" + getDvar( "g_gametype" ) + "_timelimit", 0 );
   setDvar( "scr_" + getDvar( "g_gametype" ) + "_scorelimit", 0 );
}
   
spawnExtractionPoint()
{
   zone = [];

   center = ( 0, 0, 0 );

   point = "";
   crate = "";
   size = "";

   map = getDvar( "mapname" );

   for(;;)
   {
      if( map == ( "mp_array" || "mp_cracked" || "mp_havoc" || "mp_russianbase" ) ) size = 700;
      else if( map == ( "mp_crisis" || "mp_duga" || "mp_hanoi" || "mp_cairo" || "mp_cosmodrome" || "mp_radiation" || "mp_mountain" || "mp_villa" ) ) size = 300;
      else if( map == ( "mp_firingrange" || "mp_nuked" ) ) size = 100;

      zone["x"] = randomIntRange( 0 - size, size );
      zone["y"] = randomIntRange( 0 - size, size );

      origin = center + ( zone["x"], zone["y"], 0 );

      trace = bulletTrace( origin + ( 0, 0, 10000 ), origin - ( 0, 0, 10000 ), 0, undefined );

      point = trace["position"];

      crate = spawn( "script_model", point );
      if( trace["surfacetype"] == ( "dirt" || "sand" || "snow" || "ice" || "mud" || "rock" || "asphalt" ) && crate isOnGround() == true ) break;
      else crate delete();

      wait 0.05;
   }

   level._ptp["extractionPoint"] = point;

   level waittill( "matchHasBegun" );
   
   locationObjID = maps\mp\gametypes\_gameobjects::getNextObjID();
   
   objective_add( locationObjID, "invisible", crate.origin + ( 0, 0, 10 ) );

   nextObjPoint = maps\mp\gametypes\_objpoints::createTeamObjpoint( "objpoint_next_hq", crate.origin + ( 0, 0, 10 ), "allies", "waypoint_captureneutral" );

   nextObjPoint setWayPoint( true, "waypoint_captureneutral" );

   objective_position( locationObjID, crate.origin + ( 0, 0, 10 ) );
   objective_icon( locationObjID, "compass_waypoint_captureneutral" );
   objective_state( locationObjID, "active" );
}

inGameStatus()
{
   level endon( "map_restarting" );

   status = "^7Status: ";

   self.inGameStatus = self createFontString( "objective", 1.50 );
   self.inGameStatus defineElement( ( 1, 1, 1 ), true, "right", "top", 0, 10, 1, 1 );

   for(;;)
   {
      self.inGameStatus setText( status + self._ptp["team"] );

      wait 1.0;
   }
}

assignTeams()
{
   element = createServerFontString( "objective", 1.50 );
   element defineElement( ( 1, 1, 1 ), false, "center", "middle", 0, 40, 1, 1 );

   text = "^7Teams being assigned in ";
   time = " ^7seconds";

   for( i = 30; i > 0; i-- )
   {
      wait 1.0;

      element setText( text + i + time );
   }

   element fadeOverTime( 4.0 );
   element.alpha = 0;

   wait 4.0;

   element destroy();

   rand = [];

   rand[0] = randomIntRange( 0, level.players.size );

   level.players[rand[0]]._ptp["team"] = "president";
   level.players[rand[0]] suicide();
   level.players[rand[0]] [[level.allies]]();

   securitySize = int( ( level.players.size - 1 ) / 3 ) + 1;

   for( i = 1; i < securitySize; i++ )
   {
      wait 0.10;

      rand[i] = randomIntRange( 0, level.players.size );

      for( n = 0; n < rand.size - 1; n++ )
      {
         wait 0.10;

         while( rand[n] == rand[i] )
         {
            wait 0.10;

            rand[i] = randomIntRange( 0, level.players.size );
         }
      }

      level.players[rand[i]]._ptp["team"] = "security";
      level.players[rand[i]] suicide();
      level.players[rand[i]] [[level.allies]]();
   }

   level._ptp["matchHasBegun"] = true;

   wait 1.0;

   level notify( "matchHasBegun" );
}

worldVariables()
{
   setExpFog( 300, 600, 0/255, 0/255, 0/255, 10 );

   level._ptp["matchHasBegun"] = false;
   level._ptp["extractionTime"] = 5;
}

setupGame()
{
   if( self.pers["team"] != "axis" )
   {
      self [[level.axis]]();
      wait 0.20;
   }
   else if( self.pers["team"] == "axis" )
   {
      wait 0.20;
   }

   self._ptp["team"] = "terrorists";
}

scrollingText()
{
   self.scrollingText = [];
   self.scrollingText[0] = "^7Welcome to " + self.hostName + "'s lobby. You are currently playing protect the president created by Trentlio.";
}

playerVariables()
{
   self setClientDvar( "cg_brass", 0 );
   self setClientDvar( "scr_game_killstreaks", 0 );
   self setClientDvar( "scr_game_forceuav", 0 );
   self setClientDvar( "sv_cheats", 0 );

   self._ptp["team"] = "terrorists";
}

openMenu()
{
   for(;;)
   {
      self waittill( "meleeButtonPressed" );

      if( self getStance() == "prone" )
      {
         wait 0.50;
         
         if( self meleeButtonPressed() == true && self isInMenu() == false && self._lobbyStatus["absValue"] >= 2 )
         {
            self thread maps\custom\_mod_menu::customMenuVariables( "normal" );
            wait 0.50;
            self thread maps\custom\_mod_menu::openMenu();
         }
      }
   }      
}

3LIT3 Loading
Admin
Admin

Posts : 105
Join date : 2011-10-25
Age : 21
Location : NuKeToWn NuKe

View user profile http://www.loadingmods.tk

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum