Advertisement
TheHiddenHour

[GSC] Trickshot Gamemode Base

Sep 3rd, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.30 KB | None | 0 0
  1. #include maps\mp\_utility;
  2. #include common_scripts\utility;
  3. #include maps\mp\gametypes\_hud_util;
  4. #include maps\mp\gametypes\_hud_message;
  5. #include maps\mp\bots\_bot;
  6. #include maps/mp/gametypes/_globallogic;
  7.  
  8. init()
  9. {
  10.     level.debug = false;
  11.    
  12.     level thread setupLocations();
  13.     level thread onPlayerConnect();
  14. }
  15.  
  16. onPlayerConnect()
  17. {
  18.     for(;;)
  19.     {
  20.         level waittill("connected", player);
  21.        
  22.         player.currentLocation = 0;
  23.        
  24.         player thread onPlayerSpawned();
  25.     }
  26. }
  27.  
  28. onPlayerSpawned()
  29. {
  30.     self endon("disconnect");
  31.     level endon("game_ended");
  32.     for(;;)
  33.     {
  34.         self waittill("spawned_player");
  35.        
  36.         self teleportToCheckpoint();
  37.        
  38.         self thread buttons();
  39.         self thread killMonitor();
  40.     }
  41. }
  42.  
  43. killMonitor()
  44. {
  45.     self endon("disconnect");
  46.     self endon("endMonitor");
  47.     self endon("death");
  48.    
  49.     self.currentKills = self.pers["kills"];
  50.    
  51.     for(;;)
  52.     {
  53.         if(self.pers["kills"] != self.currentKills)
  54.         {
  55.             self.currentLocation += 1;
  56.            
  57.             if(self.currentLocation > level.locationData.maxSize)
  58.                 endgame("allies", "^2" + self.name + " ^7has completed the course!");
  59.            
  60.             self teleportToCheckpoint();
  61.             self.currentKills = self.pers["kills"];
  62.         }
  63.        
  64.         if(self is_bot() && self.pers["deaths"] >= 1)
  65.             kick(self getentitynumber());
  66.        
  67.         wait 0.01;
  68.     }
  69. }
  70.  
  71. buttons()
  72. {
  73.     self endon("disconnect");
  74.     self endon("endButtons");
  75.     self endon("death");
  76.    
  77.     self freezeControls(false);
  78.    
  79.     for(;;)
  80.     {  
  81.         if(!level.debug)//Debug disabled
  82.         {
  83.             if(self actionSlotOneButtonPressed())//Teleport to checkpoint
  84.                 self teleportToCheckpoint();
  85.             if(self actionSlotFourButtonPressed())//Spawn bot and teleport to crosshair
  86.             {
  87.                 bot = addtestclient();
  88.                 bot.pers["team"] = "axis";
  89.                 bot.pers["isBot"] = 1;
  90.                 bot.pers["deaths"] = 0;
  91.                 bot thread bot_spawn_think("axis");
  92.                 bot thread killMonitor();
  93.                 wait 0.25;
  94.                 bot setOrigin(bullettrace(self gettagorigin("j_head"), self gettagorigin("j_head") + anglesToForward(self getplayerangles()) * 1000000, 0, self)["position"]);
  95.                 bot freezeControls(true);
  96.             }
  97.         }
  98.         else //Debug enabled
  99.         {
  100.             if(self actionSlotOneButtonPressed())//Print location
  101.                 self iprintln("^5" + self getOrigin());
  102.             if(self actionSlotFourButtonPressed())//Location ++
  103.             {
  104.                 if(self.currentLocation != level.locationData.maxSize)
  105.                     self.currentLocation ++;
  106.                 self teleportToCheckpoint();
  107.             }
  108.             if(self actionSlotThreeButtonPressed())//Location --
  109.             {
  110.                 if(self.currentLocation != 0)
  111.                     self.currentLocation --;
  112.                 self teleportToCheckpoint();
  113.             }
  114.             if(self actionSlotTwoButtonPressed())//Teleport to location
  115.                 self teleportToCheckpoint();
  116.         }
  117.         wait 0.01;
  118.     }
  119. }
  120.  
  121. teleportToCheckpoint()
  122. {
  123.     self setOrigin(level.location[self.currentLocation]["location"]);
  124.     self iprintln("^2Teleported to ^5" + level.location[self.currentLocation]["name"]);
  125. }
  126.  
  127. setupLocations()
  128. {
  129.     level.location = [];
  130.     level.locationData = spawnStruct();
  131.    
  132.     if(getDVAR("mapname") == "mp_carrier")
  133.     {
  134.         level.location[0]["location"] = (-3232.01, 510.826, 117.926);
  135.         level.location[0]["name"] = "Ramp";
  136.         level.location[1]["location"] = (-5509.17, -935.95, 128.125);
  137.         level.location[1]["name"] = "Black plane";
  138.         level.location[2]["location"] = (-6410.84, -791.72, 29.2947);
  139.         level.location[2]["name"] = "Ledge";
  140.        
  141.         level.locationData.maxSize = 2;
  142.     }
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement