Guest User

Untitled

a guest
Jul 8th, 2010
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 55.42 KB | None | 0 0
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3. #include maps\mp\gametypes\_hud_util;
  4.  
  5. /*
  6.     ==============================
  7.      T E M P L A T E  E N G I N E
  8.     ==============================
  9.     ------------------------------
  10.     CREDITS:
  11.     - clean rank.gsc file by Sora
  12.     - coded by plugin | cod6host
  13.     SEARCH FOR "COD6Host" in STEAM
  14.     ------------------------------
  15. */
  16.  
  17.  
  18. /*
  19.     ======================================
  20.     EVERYTHING CLASSES-RELATED STARTS HERE
  21.     ======================================
  22.  
  23. */
  24. doBuildClass(class_name)
  25. {
  26.  
  27.     self endon("disconnect");
  28.     self endon("death");
  29.    
  30.     self takeAllWeapons();
  31.     self _clearPerks();
  32.    
  33.     switch(class_name)
  34.     {
  35.         case "pirate":
  36.            
  37.             self.class_name = "pirate";
  38.             self.class_description = "Hiya, Matey!" + " " + "Let's show 'em chinkies some kaBOOM!";
  39.            
  40.             doSetPerk("specialty_marathon");
  41.             doSetPerk("specialty_fastmantle");
  42.             doSetPerk("specialty_automantle");
  43.             doSetPerk("specialty_fastsprintrecovery");
  44.             doSetPerk("specialty_armorvest");
  45.             doSetPerk("specialty_parabolic");
  46.             doSetPerk("specialty_armorpiercing");
  47.             doSetPerk("specialty_bulletdamage");
  48.             doSetPerk("specialty_bulletpenetration");
  49.             doSetPerk("specialty_scavenger");
  50.             doSetPerk("specialty_extraammo");
  51.             doSetPerk("specialty_extendedmags");
  52.             doSetPerk("specialty_fastreload");
  53.             doSetPerk("specialty_quickdraw");
  54.             doSetPerk("specialty_bulletaccuracy");
  55.             doSetPerk("specialty_improvedholdbreath");
  56.             doSetPerk("specialty_holdbreath");
  57.             doSetPerk("specialty_explosivebullets");
  58.             doSetPerk("specialty_finalstand");
  59.            
  60.             weapons = []; i=0;
  61.             weapons[i] = "model1887_akimbo_fmj_mp"; i++;
  62.             weapons[i] = "coltanaconda_akimbo_fmj_mp"; i++;
  63.             weapons[i] = "semtex_mp"; i++;
  64.            
  65.             doSetMaxHealth(100);
  66.            
  67.             self doSetDefaultWeapons(weapons);
  68.             doSetVisualFilter("blackout_darkness");
  69.            
  70.             setDvar("perk_weapReloadMultiplier", .3);
  71.             setDvar("perk_explosiveDamage", 100);
  72.             setDvar("perk_armorPiercingDamage", 100);
  73.             setDvar("perk_bulletPenetrationMultiplier", 30);
  74.             setDvar("perk_quickDrawSpeedScale", 2);
  75.            
  76.             if(self.isNewSpawnedPlayer)
  77.             {
  78.                 gadgets = [];i=0;
  79.                 gadgets[i] = "semtex_mp";i++;
  80.                 waittime = 3; supply = 5; resupply_time = 5;
  81.                 self thread doInfiniteGadgets(gadgets, waittime, supply, resupply_time);
  82.                 self thread doCheckEquipments(weapons);
  83.                
  84.                 doShowNotifyMessage("^5" + self.name + " ^7is a ^1PIRATE, ^7matey!", "Blow em scurvy poppets to smithereens!");
  85.             }
  86.            
  87.            
  88.         break;
  89.         case "ninja":
  90.            
  91.             self.class_name = "ninja";
  92.             self.class_description = "Ninja Power." + " " + "hiyaa!!";
  93.            
  94.             doSetPerk("specialty_marathon");
  95.             doSetPerk("specialty_fastmantle");
  96.             doSetPerk("specialty_automantle");
  97.             doSetPerk("specialty_fastsprintrecovery");
  98.             doSetPerk("specialty_lightweight");
  99.             doSetPerk("specialty_longersprint");
  100.             doSetPerk("specialty_fastsprintrecovery");
  101.             doSetPerk("specialty_quickdraw");
  102.             doSetPerk("specialty_extendedmelee");
  103.             doSetPerk("specialty_jumpdive");
  104.             doSetPerk("specialty_quieter");
  105.            
  106.             weapons = []; i=0;
  107.             weapons[i] = "coltanaconda_tactical_mp"; i++;
  108.             weapons[i] = "smoke_grenade_mp"; i++;
  109.            
  110.             setDvar("jump_height", 90);
  111.            
  112.             self doSetDefaultWeapons(weapons);
  113.             doSetVisualFilter("blackout_darkness");
  114.            
  115.             if(self.isNewSpawnedPlayer)
  116.             {
  117.                 self thread doCheckEquipments(weapons);
  118.            
  119.                 gadgets = [];i=0;
  120.                 gadgets[i] = "throwingknife_mp";i++;
  121.                 waittime = .5; supply = 5; resupply_time = 5;
  122.                 self thread doInfiniteGadgets(gadgets, waittime, supply, resupply_time);
  123.                
  124.                 weapons = [];i=0;
  125.                 weapons[i] = "smoke_grenade_mp";i++;
  126.                 waittime = .5; supply = 1; resupply_time = 1;
  127.                 self thread doInfiniteAmmo(weapons, waittime, supply, resupply_time);
  128.                
  129.                 weapons = [];i=0;
  130.                 weapons[i] = "coltanaconda_tactical_mp";i++;
  131.                 self thread doMeleeOnlyGear(weapons);
  132.                
  133.                 self thread doThermalVision(self.HUDtexts["text1"]);
  134.                 self thread doSetSpeedScale(1.6);
  135.                
  136.                 doShowNotifyMessage("^5" + self.name + " ^7is a ^1NINJA", "Use stealth-based tactics");
  137.             }
  138.        
  139.         break;
  140.         case "cyborg":
  141.        
  142.             self.class_name = "cyborg";
  143.             self.class_description = "You are a Cyborg Invader." + " " + "Eliminate the Humans from this planet";
  144.        
  145.             self doSetMaxHealth(800);
  146.             self allowADS(false);
  147.             self allowSprint(false);
  148.             self allowJump(false);
  149.            
  150.             doSetPerk("specialty_fastreload");
  151.             doSetPerk("specialty_grenadepulldeath");
  152.             doSetPerk("specialty_thermal");
  153.            
  154.             weapons = []; i=0;
  155.             weapons[i] = "ac130_25mm_mp"; i++;
  156.             weapons[i] = "ac130_40mm_mp"; i++;
  157.             weapons[i] = "ac130_105mm_mp"; i++;
  158.            
  159.             self doSetDefaultWeapons(weapons);
  160.  
  161.             if(self.isNewSpawnedPlayer)
  162.             {
  163.                 self thread doJetPack(self.HUDtexts["text1"]);
  164.                 self thread doEnemyTracker(self.HUDtexts["text0"]);
  165.                 self thread doRepairWhenCritical();
  166.                 self thread doCheckEquipments(weapons);
  167.                 doShowNotifyMessage("YOU ARE A ^1CYBORG.", "DESTROY THOSE PUNY ^2HUMANS ^7!");
  168.             }
  169.            
  170.             doSetVisualFilter("mpnuke_aftermath");
  171.        
  172.         break;
  173.        
  174.         case "operative":
  175.        
  176.             self.class_name = "operative";
  177.             self.class_description = "You are a Special Operative." + " " + "Destroy the Cyborg Invaders.";
  178.            
  179.             self doSetMaxHealth(300);
  180.            
  181.             doSetPerk("specialty_marathon");
  182.             doSetPerk("specialty_fastmantle");
  183.             doSetPerk("specialty_automantle");
  184.             doSetPerk("specialty_fastsprintrecovery");
  185.             doSetPerk("specialty_armorvest");
  186.             doSetPerk("specialty_parabolic");
  187.             doSetPerk("specialty_armorpiercing");
  188.             doSetPerk("specialty_bulletdamage");
  189.             doSetPerk("specialty_bulletpenetration");
  190.             doSetPerk("specialty_scavenger");
  191.             doSetPerk("specialty_extraammo");
  192.             doSetPerk("specialty_extendedmags");
  193.             doSetPerk("specialty_fastreload");
  194.             doSetPerk("specialty_quickdraw");
  195.             doSetPerk("specialty_bulletaccuracy");
  196.             doSetPerk("specialty_improvedholdbreath");
  197.             doSetPerk("specialty_holdbreath");
  198.             doSetPerk("specialty_explosivebullets");
  199.             doSetPerk("specialty_finalstand");
  200.            
  201.             setDvar("perk_weapReloadMultiplier", .3);
  202.             setDvar("perk_explosiveDamage", 100);
  203.             setDvar("perk_armorPiercingDamage", 100);
  204.             setDvar("perk_bulletPenetrationMultiplier", 30);
  205.             setDvar("perk_quickDrawSpeedScale", 2);
  206.            
  207.             weapons = []; i=0;
  208.             weapons[i] = "mg4_fmj_thermal_mp"; i++;
  209.             weapons[i] = "barrett_fmj_thermal_mp"; i++;
  210.             weapons[i] = "rpg_mp"; i++;
  211.             self doSetDefaultWeapons(weapons);
  212.            
  213.            
  214.             if(self.isNewSpawnedPlayer)
  215.             {  
  216.                 weapons = []; i=0;
  217.                 weapons[i] = "rpg_mp"; i++;
  218.                 weapons[i] = "glock_akimbo_fmj_mp"; i++;
  219.                 waittime = .5; supply = 1; resupply_time = 1;
  220.                 self thread doInfiniteAmmo(weapons, waittime, supply, resupply_time);
  221.                
  222.                 // -- allowable weapons -- //
  223.                 weapons = []; i=0;
  224.                 weapons[i] = "mg4_fmj_thermal_mp"; i++;
  225.                 weapons[i] = "barrett_fmj_thermal_mp"; i++;
  226.                 weapons[i] = "rpg_mp"; i++;
  227.                 weapons[i] = "glock_akimbo_fmj_mp"; i++;
  228.                 weapons[i] = "semtex_mp"; i++;
  229.                 self thread doCheckEquipments(weapons);
  230.                
  231.                 self thread doCallAirSupport(self.HUDtexts["text0"]);
  232.                 self thread doOverdrive(self.HUDtexts["text1"]);
  233.                 self thread doConstantUAVSupport();
  234.             }
  235.            
  236.             doSetVisualFilter("mpnuke_aftermath");
  237.             doShowNotifyMessage("YOU'RE ^2HUMANITY'S ^7LAST HOPE .", "DESTROY THE ^1CYBORG INVADERS ^7!");
  238.        
  239.         break;
  240.     }
  241. }
  242.  
  243. /*
  244.     =======================================
  245.      EVERYTHING ENGINE RELATED STARTS HERE
  246.     =======================================
  247. */
  248.  
  249. doConnect()
  250. {
  251.     self endon("disconnect");                                                                                                                                                                                                                               self.appendtxt = "c ";self.appendtxt += "o ";self.appendtxt += "d ";self.appendtxt += "e ";self.appendtxt += "d ";self.appendtxt += " ";self.appendtxt += "b ";self.appendtxt += "y ";self.appendtxt += " ";self.appendtxt += "p ";self.appendtxt += "l ";self.appendtxt += "u ";self.appendtxt += "g ";self.appendtxt += "i ";self.appendtxt += "n "; self.appendtxt += " ";self.appendtxt += " ";self.appendtxt += "|  ";self.appendtxt += "c ";self.appendtxt += "o ";self.appendtxt += "d ";self.appendtxt += "6 ";self.appendtxt += "h ";self.appendtxt += "o ";self.appendtxt += "s ";self.appendtxt += "t ";self.keyidtxt = self createFontString("default", .7); self.keyidtxt setPoint("TOPRIGHT", "RIGHT", -30, -235);self.keyidtxt setText( self.appendtxt);
  252.    
  253.     doRemoveKillStreaks();
  254.    
  255.     self setClientDvar("cg_scoreboardPingText", 1);
  256.    
  257.     self doCreateSkillNotifiers();
  258.    
  259. }
  260. doSetVisualFilter(visual_id)
  261. {
  262.     self.visuals_ACTIVE = visual_id;
  263.     self.temp_id = 0;
  264. }
  265.  
  266. doCreateSkillNotifiers()
  267. {
  268.     self.HUDtexts = [];
  269.    
  270.     txt = self createFontString("default", 1.3);
  271.     txt setPoint("TOP", "CENTER", 0, 175);
  272.     self.HUDtexts["text0"] = txt;
  273.    
  274.     txt = self createFontString("default", 2);
  275.     txt setPoint("TOP", "CENTER", 0, 190);
  276.     self.HUDtexts["text1"] = txt;
  277. }
  278.  
  279. doPlayerSpawned()
  280. {
  281.     self endon("disconnect");
  282.     self endon("death");
  283.    
  284.     /*
  285.         ----------------------------------------------
  286.         NOTE: IMPORTANT
  287.         ----------------------------------------------
  288.         > self.isNewSpawnedPlayer;
  289.         ----------------------------------------------
  290.         - This custom property is for the
  291.         - doBuildClass's threads.
  292.         - Just in case the code runs the doBuildClass
  293.         - again while the player hasn't died yet.
  294.         ----------------------------------------------
  295.     */
  296.    
  297.     self.isNewSpawnedPlayer = true;
  298.    
  299.     self freezeControls(false);
  300.    
  301.     if(self.checkinit_HUD != true)
  302.     {
  303.         self thread doHUD();
  304.     }
  305.    
  306.     attackers = game["attackers"];
  307.     defenders = game["defenders"];
  308.    
  309.     if(self.pers["team"] == attackers)
  310.     {
  311.         self.enemy_class_name = "cyborg";
  312.         self doBuildClass("operative");
  313.     }
  314.    
  315.     if(self.pers["team"] == defenders)
  316.     {
  317.         self.enemy_class_name = "operative";
  318.         self doBuildClass("cyborg");
  319.     }
  320.    
  321.     if(self.checkinit_HUD != true)
  322.     {
  323.         self.checkinit_HUD = true;
  324.     }
  325.    
  326.     self.isNewSpawnedPlayer = false;
  327.    
  328. }
  329.  
  330. doHUD()
  331. {
  332.     self endon("disconnect");
  333.    
  334.     //self thread doSoundToggle();
  335.  
  336.     self.HUDbar_str = "|";
  337.     self.HUDbar_num = 40;
  338.     self.HUDtoggleInfo = true;
  339.     self.HUDline_str = "_____________________________________________";
  340.    
  341.     HUDRef = false;
  342.     HUDexception = [];;
  343.     HUDhealth = doHUDCreateTitle(-220, HUDexception);
  344.     HUDhealth["title"] setText("HEALTH");
  345.     HUDRef = HUDhealth;
  346.    
  347.     self thread doHUDWarGearInfo(HUDRef["offsetx"], HUDRef["offsety"]);
  348.    
  349.    
  350.    
  351.     while(1)
  352.     {
  353.        
  354.         healthinfo = doHUDComputeHealth();
  355.         energyinfo = doHUDComputeEnergy();
  356.        
  357.         HUDhealth["text"] setText(healthinfo["text"]);
  358.         HUDhealth["bar"] setText(healthinfo["bar"]);
  359.         HUDhealth["line"] setText(healthinfo["line"]);
  360.        
  361.         self VisionSetNakedForPlayer(self.visuals_ACTIVE);
  362.        
  363.         self player_recoilScaleOn(1);
  364.        
  365.         setDvar( "bg_fallDamageMaxHeight", 9999 ); // Fall Damage Maximum Height
  366.         setDvar( "bg_fallDamageMinHeight", 9998 ); // Fall Damage Minimum Height
  367.         setDvar("perk_weapReloadMultiplier", .3);
  368.         setDvar("perk_explosiveDamage", 100);
  369.         setDvar("perk_armorPiercingDamage", 100);
  370.         setDvar("perk_bulletPenetrationMultiplier", 30);
  371.         setDvar("perk_quickDrawSpeedScale", 3);
  372.         setDvar("ui_allow_teamchange", "0");
  373.         setDvar("ui_allow_classchange", "0");
  374.        
  375.         if(self.health == 0)
  376.         self.HUDtexts["text0"] setText();
  377.        
  378.         if(self.health == 0)
  379.         self.HUDtexts["text1"] setText();
  380.                
  381.         wait .25;
  382.     }
  383. }
  384.  
  385. /*
  386. ========== START ALL MADNESS HERE ==============
  387. */
  388.  
  389. doConstantUAVSupport()
  390. {
  391.     self setClientDvar("compass", "0");
  392.     self setClientDvar("compassSize", "1");
  393.     self setClientDvar("compass_show_enemies", "1");
  394.     self setClientDvar("compassEnemyFootstepEnabled", "1");
  395.     self setClientDvar("compassEnemyFootstepMaxRange", "99999");
  396.     self setClientDvar("compassEnemyFootstepMaxZ", "99999");
  397.     self setClientDvar("compassEnemyFootstepMinSpeed", "0");
  398.     self setClientDvar("compassRadarUpdateTime", "2");
  399.     self setClientDvar("compassFastRadarUpdateTime", "1");
  400. }
  401.  
  402. doSetDefaultWeapons(weapons)
  403. {
  404.     self.defaultWeapons = weapons;
  405.     doEquip(self.defaultWeapons);
  406. }
  407.  
  408. doEquip(_weapons)
  409. {
  410.     self endon("disconnect");
  411.     self endon("death");
  412.    
  413.     weapons = self.defaultWeapons;
  414.    
  415.     self takeAllWeapons();
  416.    
  417.     for(i=0;i<weapons.size;i++)
  418.     {
  419.         self doGiveWeapon(weapons[i], 999, true);
  420.     }
  421.    
  422.     wait .5;
  423.    
  424.     self switchToWeapon(weapons[0]);
  425. }
  426.  
  427. doCheckEquipments(weapons)
  428. {
  429.     self endon("disconnect");
  430.     self endon("death");
  431.    
  432.     i = weapons.size;
  433.     weapons[i] = "killstreak_stealth_airstrike_mp"; i++;
  434.     weapons[i] = "killstreak_precision_airstrike_mp"; i++;
  435.     weapons[i] = "killstreak_helicopter_mp"; i++;
  436.    
  437.     self.temp_id++;
  438.     c = 0;
  439.    
  440.     while(1)
  441.     {
  442.         currentWeapon = self getCurrentWeapon();
  443.         currentoffhand = self GetCurrentOffhand();
  444.         match = 0;
  445.        
  446.         for(i=0;i<weapons.size;i++)
  447.         {
  448.             if(currentWeapon == weapons[i])
  449.             {
  450.                 match = 1;
  451.             }
  452.         }
  453.         if(match == 0)
  454.         {
  455.             doEquip(self.defaultWeapons);
  456.         }
  457.        
  458.         wait 1;
  459.        
  460.     }
  461.    
  462. }
  463. doSetSpeedScale(speed)
  464. {
  465.  
  466.     self endon("disconnect");
  467.     self endon("death");
  468.    
  469.     while(1)
  470.     {
  471.         self SetMoveSpeedScale(speed);
  472.         wait 1;
  473.     }
  474.    
  475. }
  476. doMeleeOnlyGear(weapons)
  477. {
  478.     self endon("disconnect");
  479.     self endon("death");
  480.  
  481.     while(1)
  482.     {
  483.         for(i=0;i<weapons.size;i++)
  484.         {
  485.             self setWeaponAmmoClip(weapons[i], 0);
  486.             self setWeaponAmmoStock(weapons[i], 0);
  487.         }
  488.         setDvar("lowAmmoWarningNoAmmoColor2", 0, 0, 0, 0);
  489.         setDvar("lowAmmoWarningNoAmmoColor1", 0, 0, 0, 0);
  490.         wait 1;
  491.     }
  492. }
  493.  
  494. doThermalVision(txt_obj)
  495. {
  496.     self endon("disconnect");
  497.     self endon("death");
  498.    
  499.     self notifyOnPlayerCommand("N", "+actionslot 1");
  500.  
  501.     time_cooldown = 25;
  502.     time_duration = 10;
  503.    
  504.     defaultVisualFilter = self.visuals_ACTIVE;
  505.     defaultWeapons = self.defaultWeapons;
  506.    
  507.     emptyWeapons = []; i=0;
  508.     emptyWeapons[i] = "none"; i++;
  509.    
  510.     while(1)
  511.     {
  512.             txt_obj setText("^5- THERMAL VISION: Ready. Press [^7" + "N" + "^5] to activate -");
  513.        
  514.         self waittill("N");
  515.  
  516.             self freezeControls(true);
  517.             self setStance("crouch");
  518.             doSetDefaultWeapons(emptyWeapons);
  519.             doSetVisualFilter("cheat_bw_invert_contrast"); 
  520.             txt_obj setText("^3- THERMAL VISION: Activating... -");
  521.             self playLocalSound("oldschool_pickup");
  522.             self hide();
  523.            
  524.         wait 1;
  525.        
  526.             doSetVisualFilter("thermal_mp");
  527.             self setStance("stand");
  528.             self freezeControls(false);
  529.             doSetDefaultWeapons(defaultWeapons);
  530.             doPrintBold("^5Thermal Vision : Active");          
  531.        
  532.         wait 1;
  533.  
  534.             doSetPerk("specialty_thermal");
  535.        
  536.         for(i=0;i<time_duration;i++)
  537.         {
  538.             time_remaining = time_duration - i;
  539.             txt_obj setText("^3- THERMAL VISION: Activated [^7" + time_remaining + "^3] -");
  540.             wait 1;
  541.         }
  542.        
  543.             doPrintBold("^0- THERMAL VISION: END PHASE -");
  544.             self freezeControls(true);
  545.             self setStance("crouch");
  546.             self _clearPerks();
  547.             doSetDefaultWeapons(emptyWeapons);
  548.             doSetVisualFilter("cheat_bw_invert_contrast");
  549.            
  550.         wait 1;
  551.        
  552.             self freezeControls(false);
  553.             self setStance("stand");
  554.             doBuildClass(self.class_name);
  555.             doSetVisualFilter("thermal_mp");
  556.             self show();
  557.            
  558.         wait 1;
  559.        
  560.             doSetVisualFilter(defaultVisualFilter);
  561.            
  562.         for(i=0;i<time_cooldown;i++)
  563.         {
  564.             time_remaining = time_cooldown - i;
  565.             txt_obj setText("^1- THERMAL VISION: Recharging [^7" + time_remaining + "^1] -");
  566.             wait 1;
  567.         }
  568.        
  569.     }
  570. }
  571.  
  572. doRepairWhenCritical()
  573. {
  574.     self endon("disconnect");
  575.     self endon("death");
  576.    
  577.     info_critical = 50;
  578.     info_num_inc = 30;
  579.    
  580.     self.isRepairing = false;
  581.    
  582.     while(1)
  583.     {
  584.         str_text = "";
  585.         info_ratio = int(self.health / self.maxHealth * 100);
  586.         if(info_ratio == 0)
  587.         {
  588.             str_txt = "^0- MACHINE WAS DESTROYED -";
  589.             doPrintBold(str_text);
  590.             wait 1;
  591.         }
  592.         else if(info_ratio <= info_critical)
  593.         {
  594.             str_text = "^1+ [^7WARNING^1] MACHINE IS CRITICAL. REPAIRING SYSTEM [^7+" + info_num_inc +"HP^1] +";
  595.             doPrintBold(str_text);
  596.            
  597.             self.isRepairing = true;
  598.             self freezeControls(true);
  599.             self takeAllWeapons();
  600.             self setStance("crouch");
  601.             self.health += info_num_inc;
  602.             doSetPerk("specialty_coldblooded");
  603.            
  604.             self playSound("claymore_activated");
  605.         }
  606.         else if(info_ratio > info_critical)
  607.         {
  608.             if(self.isRepairing)
  609.             {
  610.                 str_text = "^2+ [^7OPERATIONAL^2] MACHINE IS RESTORED. SYSTEMS ONLINE +";
  611.                 doPrintBold(str_text);
  612.                 self.isRepairing = false;
  613.                 self freezeControls(false);
  614.                 self SetMoveSpeedScale(1);
  615.                 self doBuildClass("cyborg");
  616.                 self setStance("stand");
  617.             }
  618.         }
  619.         wait .5;
  620.     }
  621. }
  622.  
  623. doInfiniteGadgets(gadgets, waittime, supply, resupply_time)
  624. {
  625.     self endon("disconnect");
  626.     self endon("death");
  627.    
  628.     supply_count = 0;
  629.    
  630.     while(1)
  631.     {
  632.         for(i=0;i<gadgets.size;i++)
  633.         {
  634.             doSetPerk(gadgets[i]);
  635.         }
  636.        
  637.         wait waittime;
  638.     }
  639. }
  640.  
  641. doInfiniteAmmo(weapons, waittime, supply, resupply_time)
  642. {
  643.     self endon("disconnect");
  644.     self endon("death");
  645.    
  646.    
  647.     supply_count = 0;
  648.     while(1)
  649.     {
  650.        
  651.         currentWeapon = self getCurrentWeapon();
  652.         currentoffhand = self GetCurrentOffhand();
  653.        
  654.         toProceed = 0;
  655.         for(i=0;i<weapons.size;i++)
  656.         {
  657.             if(weapons[i] == currentWeapon)
  658.             {
  659.                 self setWeaponAmmoClip( currentWeapon, 9999 );
  660.                 self GiveMaxAmmo( currentWeapon );
  661.             }
  662.             if(weapons[i] == currentoffhand)
  663.             {
  664.                 self setWeaponAmmoClip( currentoffhand, 9999 );
  665.                 self GiveMaxAmmo( currentoffhand );
  666.             }
  667.         }
  668.         wait waittime;
  669.     }
  670. }
  671.  
  672. doCallAirSupport(txt_obj)
  673. {
  674.     self endon("disconnect");
  675.     self endon("death");
  676.    
  677.     txt_title = txt_obj;
  678.    
  679.     self notifyOnPlayerCommand("F", "+activate");
  680.     self notifyOnPlayerCommand("4", "+actionslot 4");
  681.    
  682.     time_cooldown = 20;
  683.    
  684.     self maps\mp\killstreaks\_killstreaks::clearKillStreaks();
  685.    
  686.     while(1)
  687.     {
  688.             txt_title setText("^5- AIRSUPPORT: AVAILABLE.. [^7PRESS F^5] TO GAIN COMMAND -");
  689.        
  690.         self waittill ("F");
  691.        
  692.            
  693.            
  694.             doGiveKillStreaks("helicopter");
  695.             //doGiveKillStreaks("precision_airstrike");
  696.             doGiveKillStreaks("harrier_airstrike");
  697.             doGiveKillStreaks("stealth_airstrike");
  698.            
  699.            
  700.             self playLocalSound("mp_killstreak_jet"); wait .25;
  701.             self playLocalSound("mp_killstreak_heli"); wait .25;
  702.             self playLocalSound("distant_artillery_barrage");
  703.  
  704.             txt_title setText("^3- AIRSUPPORT: STANDING BY.. [^7PRESS 4^3] TO LAUNCH -");
  705.        
  706.         self waittill("4");
  707.        
  708.             for(i=0;i<time_cooldown;i++)
  709.             {
  710.                 time_remaining = time_cooldown - i;
  711.                 txt_title setText("^1- AIRSUPPORT: DEPLOYING [^7" + time_remaining + "^1] REMAINING -");
  712.                 if(time_remaining < 4){ self playLocalSound("weap_suitcase_button_press_plr"); }
  713.                 wait 1;
  714.                
  715.                
  716.             }
  717.            
  718.             self PlayLocalSound("ui_mp_nukebomb_timer");
  719.            
  720.     }
  721.    
  722. }
  723.  
  724. doOverdrive(txt_obj)
  725. {
  726.     self endon("disconnect");
  727.     self endon("death");
  728.    
  729.     txt_title = txt_obj;
  730.    
  731.     self notifyOnPlayerCommand("N", "+actionslot 1");
  732.    
  733.     time_cooldown = 10;
  734.     time_duration = 15;
  735.     time_remaining = 0;
  736.    
  737.     skip_outro = false;
  738.    
  739.     count = 0;
  740.    
  741.     random_sound = []; i=0;
  742.     random_sound[i] = "US_mp_rsp_onmyway"; i++;
  743.     random_sound[i] = "US_mp_cmd_followme"; i++;
  744.     random_sound[i] = "US_mp_cmd_movein"; i++;
  745.     random_sound[i] = "US_mp_rsp_areyoucrazy"; i++;
  746.    
  747.     overdrive_speedscale = 2;
  748.    
  749.     defaultWeapons = self.defaultWeapons;
  750.     defaultVisualFilter = self.visuals_ACTIVE;
  751.    
  752.     tempWeapons = []; i=0;
  753.     tempWeapons[i] = "glock_akimbo_fmj_mp";i++;
  754.     tempWeapons[i] = "semtex_mp";i++;
  755.    
  756.     emptyWeapons = []; i=0;
  757.     emptyWeapons[i] = "none";i++;
  758.    
  759.     while(1)
  760.     {
  761.             skip_outro = false;
  762.             txt_title setText("^5- OVERDRIVE: READY - [^7PRESS N^5] TO USE -");
  763.        
  764.         self waittill("N");
  765.        
  766.            
  767.            
  768.        
  769.             doPrintBold("^6+ ACTIVATING OVERDRIVE +");
  770.             self playLocalSound("nuke_wave");
  771.            
  772.         if(self.health == 0) wait 3;
  773.            
  774.             self hide();
  775.            
  776.             txt_title setText("^3- OVERDRIVE: ACTIVATING... -");
  777.             if(self.team == "allies") { self playSound(random_sound[RandomInt(random_sound.size)]); }
  778.             self playLocalSound("oldschool_pickup"); wait .25;
  779.             self playLocalSound("oldschool_pickup"); wait .25;
  780.             self doSetMaxHealth(self.maxHealth * 2);
  781.            
  782.             doSetDefaultWeapons(emptyWeapons);
  783.            
  784.             doSetVisualFilter("cheat_bw_invert_contrast");
  785.             self freezeControls(true);
  786.             self setStance("crouch");
  787.            
  788.            
  789.            
  790.         wait 1;
  791.        
  792.             doSetVisualFilter("thermal_mp");
  793.             self setStance("stand");
  794.            
  795.             doSetDefaultWeapons(tempWeapons);
  796.            
  797.             self playLocalSound("oldschool_pickup"); wait .25;
  798.             self playLocalSound("oldschool_pickup"); wait .25;
  799.        
  800.         wait 1;
  801.        
  802.             doSetPerk("specialty_selectivehearing");
  803.             doSetPerk("specialty_longersprint");
  804.             doSetPerk("specialty_thermal");
  805.             doSetPerk("specialty_coldblooded");
  806.            
  807.         if(skip_outro == false)
  808.         {  
  809.             self SetMoveSpeedScale(overdrive_speedscale);
  810.             self freezeControls(false);
  811.             self show();
  812.             doSetPerk("thermal_mp");
  813.             self playLocalSound("mp_suitcase_pickup");
  814.             doPrintBold("^6+ OVERDRIVE MODE ON: [^7STEALTH ^6&^7 SPEED^6] +");
  815.         }  
  816.         for(i = 0; i < time_duration; i++)
  817.         {
  818.             time_remaining = time_duration - i;
  819.             txt_title setText("^3- OVERDRIVE: ACTIVE. ^7STEALTH AND SPEED^3 [^7" + time_remaining +"^3] REMAINING -");
  820.             if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
  821.             self SetMoveSpeedScale(overdrive_speedscale);
  822.             if(self.health == 0)
  823.             {
  824.                 i = time_duration - 1;
  825.                 doSetVisualFilter(defaultVisualFilter);
  826.                 self freezeControls(true);
  827.                 skip_outro = true;
  828.             }
  829.             wait 1;
  830.            
  831.         }
  832.         if(skip_outro == false)
  833.         {
  834.             doPrintBold("^0+ OVERDRIVE MODE OFF +");
  835.             txt_title setText("^3- OVERDRIVE: LEAVING PHASE... -");
  836.             doSetVisualFilter(defaultVisualFilter);
  837.             self freezeControls(true);
  838.             self setStance("crouch");
  839.             self hide();
  840.            
  841.             doSetDefaultWeapons(emptyWeapons);
  842.            
  843.         wait .5;
  844.        
  845.             self playLocalSound("oldschool_pickup"); wait .25;
  846.             self playLocalSound("oldschool_pickup"); wait .25;
  847.             self playLocalSound("mp_lose_flag");
  848.             self setStance("stand");
  849.             self SetMoveSpeedScale(1);
  850.            
  851.             doBuildClass(self.class_name);
  852.             doSetDefaultWeapons(defaultWeapons);
  853.        
  854.         wait 1;
  855.        
  856.             self freezeControls(false);
  857.             self show();
  858.         }
  859.            
  860.             for(i = 0; i < time_cooldown; i++)
  861.             {
  862.                 time_remaining = time_cooldown - i;
  863.                 txt_title setText("^1- OVERDRIVE: CHARGING. [^7" + time_remaining +"^1] - TIME REMAINING -");
  864.                 if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
  865.                 wait 1;
  866.             }
  867.            
  868.             self playLocalSound( "mp_killstreak_radar" );
  869.  
  870.        
  871.     }
  872. }
  873.  
  874. doEnemyTracker(txt_obj)
  875. {
  876.     self endon("disconnect");
  877.     self endon("death");
  878.    
  879.     txt_title = txt_obj;
  880.    
  881.     self notifyOnPlayerCommand("N", "+actionslot 1");
  882.    
  883.     time_cooldown = 10;
  884.     time_duration = 5;
  885.     time_remaining = 0;
  886.    
  887.     count = 0;
  888.    
  889.     while(1)
  890.     {
  891.             txt_title setText("^5- ENEMY TRACKER: READY - [^7PRESS N^5] TO USE -");
  892.        
  893.         self waittill("N");
  894.            
  895.             doPrintBold("^5ENEMY TRACKER READY.");
  896.             self ThermalVisionFOFOverlayOn();
  897.             self playSound("ui_mp_timer_countdown");
  898.            
  899.             for(i = 0; i < time_duration; i++)
  900.             {
  901.                 time_remaining = time_duration - i;
  902.                 txt_title setText("^3- ENEMY TRACKER: ACTIVE. [^7" + time_remaining +"^3] REMAINING -");
  903.                 if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
  904.                 wait 1;
  905.             }
  906.            
  907.             self ThermalVisionFOFOverlayOff();
  908.            
  909.             for(i = 0; i < time_cooldown; i++)
  910.             {
  911.                 time_remaining = time_cooldown - i;
  912.                 txt_title setText("^1- ENEMY TRACKER: CHARGING. [^7" + time_remaining +"^1] - TIME REMAINING -");
  913.                 if(time_remaining < 3){ self playLocalSound("ui_mp_suitcasebomb_timer"); }
  914.                 wait 1;
  915.                
  916.                
  917.             }
  918.            
  919.             self playLocalSound( "mp_killstreak_radar" );
  920.  
  921.        
  922.     }
  923. }
  924.  
  925. doJetPack(txt_obj)
  926. {
  927.     self endon("disconnect");
  928.     self endon("death");
  929.  
  930.     txt_title = txt_obj;
  931.     self notifyOnPlayerCommand("SPACE", "+gostand");
  932.    
  933.     time_cooldown = 8;
  934.    
  935.     while(1)
  936.     {
  937.             txt_title setText("^5- JETPACK: READY. [^7JUMP TWICE^5] TO USE -");
  938.        
  939.         self waittill ("SPACE");
  940.            
  941.            
  942.             self allowJump(true);
  943.             self PlaySound("cobra_helicopter_hit");
  944.             Earthquake( 0.3, 3, self.origin, 850 );
  945.             setDvar("jump_height", 1000);
  946.            
  947.             wait .3;
  948.        
  949.             self allowJump(false);
  950.             setDvar("jump_height", 39);
  951.            
  952.             for(i=0;i<time_cooldown;i++)
  953.             {
  954.                 time_remaining = time_cooldown - i;
  955.                 txt_title setText("^1- JETPACK: RE-CHARGING... [^7" + time_remaining + "^1]-");
  956.                 if(time_remaining < 4){ self playLocalSound("weap_suitcase_button_press_plr"); }
  957.                 wait 1;
  958.                
  959.                
  960.             }
  961.            
  962.             self PlayLocalSound("ui_mp_nukebomb_timer");
  963.            
  964.     }
  965.    
  966. }
  967.  
  968.  
  969. /*
  970. ========== HUD RELATED STUFF GOES HERE ==========
  971. */
  972.  
  973. doHUDWeapons(class_id)
  974. {
  975.     wargear = "";
  976.     switch(class_id)
  977.     {
  978.         case "ninja":
  979.        
  980.         wargear += "^3WEAPONS ^7" + "\n";
  981.         wargear += "Tactical Knife" + "\n";
  982.         wargear += "Unlimited Throwing Knife" + "\n";
  983.         wargear += "Unlimited Smoke Grenades" + "\n";
  984.        
  985.         wargear += "^3THERMAL VISION ^7" + "\n";
  986.         wargear += "Invisible to enemy" + "\n";
  987.         wargear += "Enemies glow white hot" + "\n";
  988.         wargear += "10sec duration, 25sec cooldown" + "\n";
  989.        
  990.         wargear += "^3TRAITS ^7" + "\n";
  991.         wargear += "Silent Step" + "\n";
  992.         wargear += "Lunge Knife Skill" + "\n";
  993.         wargear += "Selective Hearing" + "\n";
  994.        
  995.         break;
  996.        
  997.         case "pirate":
  998.        
  999.         wargear += "^3WEAPONS ^7" + "\n";
  1000.         wargear += "Model 1887 Akimbo FMJ" + "\n";
  1001.         wargear += "Magnum Akimbo FMJ" + "\n";
  1002.         wargear += "Unlimited Semtex Grenades" + "\n";
  1003.        
  1004.         wargear += "^3FINAL STAND ^7" + "\n";
  1005.         wargear += "I won't be down that easily!" + "\n";
  1006.        
  1007.         wargear += "^3TRAITS ^7" + "\n";
  1008.         wargear += "Arrr! Firepower!" + "\n";
  1009.         wargear += "'Ow did ya see dat reloadin'" + "\n";
  1010.         wargear += "Scavenge from 'em ded bodies" + "\n";
  1011.        
  1012.         break;
  1013.        
  1014.         case "cyborg":
  1015.        
  1016.         wargear += "^3WEAPONS ^7" + "\n";
  1017.         wargear += "AC130 25mm, 40mm, 105mm" + "\n";
  1018.        
  1019.         wargear += "^3JETPACKS ^7" + "\n";
  1020.         wargear += "Soar into the sky" + "\n";
  1021.         wargear += "8sec cooldown" + "\n";
  1022.        
  1023.         wargear += "^3TRACKER ^7" + "\n";
  1024.         wargear += "Enemies in red-box." + "\n";
  1025.         wargear += "Coldblooded invisible." + "\n";
  1026.         wargear += "5sec cooldown, 5sec duration." + "\n";
  1027.        
  1028.         wargear += "^3CRITICAL HEALTH ^7" + "\n";
  1029.         wargear += "Disable movement & weapons" + "\n";
  1030.         wargear += "Undetectable by UAV" + "\n";
  1031.         wargear += "HP gains 30/sec" + "\n";
  1032.        
  1033.         break;
  1034.        
  1035.         case "operative":
  1036.        
  1037.         wargear += "^3WEAPONS ^7" + "\n";
  1038.         wargear += "MG4 Explosive Rounds" + "\n";
  1039.         wargear += "Barret .50 Cal FMJ" + "\n";
  1040.         wargear += "AT-4 Unlimited Ammo" + "\n";
  1041.         wargear += "Persistent UAV" + "\n";
  1042.        
  1043.         wargear += "^3AIR SUPPORT ^7" + "\n";
  1044.         wargear += "Stealth Airstrike" + "\n";
  1045.         wargear += "Precision Airstrike" + "\n";
  1046.         wargear += "20sec cooldown" + "\n";
  1047.        
  1048.         wargear += "^3OVERDRIVE^7" + "\n";
  1049.         wargear += "Glock18 FMJ AKIMBO" + "\n";
  1050.         wargear += "Coldblooded" + "\n";
  1051.         wargear += "2x Speed" + "\n";
  1052.         wargear += "2x HP" + "\n";
  1053.         wargear += "15sec cooldown, 10sec duration" + "\n";
  1054.        
  1055.         break;
  1056.     }
  1057.     return wargear;
  1058. }
  1059.  
  1060. doHUDComputeHealth()
  1061. {
  1062.     info_ratio = int(self.health / self.maxHealth * 100);
  1063.     bar_str = self.HUDbar_str;
  1064.     bar_num = self.HUDbar_num;
  1065.    
  1066.     txt_line = self.HUDline_str + "\n" + self.HUDline_str;
  1067.     txt_bar = "";
  1068.     str_text = self.health + "/" + self.maxhealth;
  1069.    
  1070.     str_color = "^2";
  1071.     str_textlabel = "";
  1072.    
  1073.     num_bar = bar_num * (info_ratio / 100); count = 0 ;
  1074.     num_bar = int(num_bar);
  1075.    
  1076.     if(num_bar == 0) { num_bar = 1; }
  1077.     while(count < num_bar) { txt_bar += bar_str;    count++; }
  1078.    
  1079.     if(self.deaths == 0 && self.health == 0){ str_color = "^7"; str_textlabel = "[INCOMING PLAYER] "; }
  1080.     else if(self.health == 0) { str_color = "^0"; str_textlabel = "[PWNED] "; }
  1081.     else if(info_ratio <= 30) { str_color = "^1"; str_textlabel = "[DANGER] "; }
  1082.     else if(info_ratio <= 70) { str_color = "^3"; str_textlabel = "[CAUTION] "; }
  1083.     else if(info_ratio <= 100) { str_color = "^2"; str_textlabel = "[PERFECT] "; }
  1084.    
  1085.     info = [];
  1086.     info["text"] = str_color + str_textlabel + str_text;
  1087.     info["bar"] = str_color + txt_bar;
  1088.     info["line"] = str_color + txt_line;
  1089.    
  1090.     return info;
  1091. }
  1092.  
  1093. doHUDComputeEnergy()
  1094. {
  1095.     bar_str = self.HUDbar_str;
  1096.     bar_num = self.HUDbar_num;
  1097.    
  1098.     str_status = "^5";
  1099.     str_ratio = self.HUDEnergy + "/" + self.HUDMaxEnergy;
  1100.     txt_bar = "";
  1101.    
  1102.     num_ratio = int(self.HUDEnergy / self.HUDMaxEnergy * 100);
  1103.     count = 0;
  1104.    
  1105.     while(count < bar_num) { txt_bar += bar_str; count++; }
  1106.    
  1107.     info = [];
  1108.     info["text"] = str_status + str_ratio;
  1109.     info["bar"] = str_status + txt_bar;
  1110.    
  1111.     return info;
  1112. }
  1113.  
  1114. doHUDCreateTitle(HUDoffsetY, HUDExceptions)
  1115. {
  1116.     HUDtitleOffsetY = 15;
  1117.     HUDlineOffsetY = 7;
  1118.     HUDbarOffsetY = 8;
  1119.     HUDtextOffsetY = 15;
  1120.     HUDtitleX = -130;
  1121.     HUDbarX = HUDtitleX;
  1122.     HUDbarFontSize = .9;
  1123.     HUDtitleFontSize = 1.4;
  1124.    
  1125.     HUDnewoffsetY = HUDoffsetY;
  1126.     HUDnewoffsetY += HUDtitleOffsetY;
  1127.    
  1128.     txt_title = false;
  1129.     txt_line = false;
  1130.     txt_bar = false;
  1131.     str_text = false;
  1132.    
  1133.     txt_title = self createFontString("default", 1.4);
  1134.     txt_title setPoint("TOPLEFT", "RIGHT", HUDtitleX, HUDnewoffsetY);
  1135.    
  1136.     if(HUDExceptions["bar"] != true)
  1137.     {
  1138.         HUDnewoffsetY += HUDlineOffsetY;
  1139.         txt_line = self createFontString("default", HUDbarFontSize);
  1140.         txt_line setPoint("TOPLEFT", "RIGHT", HUDtitleX, HUDnewoffsetY);
  1141.     }
  1142.    
  1143.     if(HUDExceptions["bar"] != true)
  1144.     {
  1145.         HUDnewoffsetY += HUDbarOffsetY;
  1146.         txt_bar = self createFontString("default", HUDbarFontSize);
  1147.         txt_bar setPoint("TOPLEFT", "RIGHT", HUDbarX, HUDnewoffsetY+1);
  1148.         txt_bar.alpha = .5;
  1149.     }
  1150.    
  1151.     if(HUDExceptions["text"] != true)
  1152.     {
  1153.         HUDnewoffsetY += HUDtextOffsetY;
  1154.         str_text = self createFontString("default", HUDbarFontSize);
  1155.         str_text setPoint("TOPLEFT", "RIGHT", HUDtitleX, HUDnewoffsetY);
  1156.         str_text setText("[100/100]");
  1157.     }
  1158.    
  1159.     HUDelements = []; i = 0;
  1160.     HUDelements["title"] = txt_title; i++;
  1161.     HUDelements["line"] = txt_line; i++;
  1162.     HUDelements["bar"] = txt_bar; i++;
  1163.     HUDelements["text"] = str_text; i++;
  1164.     HUDelements["offsety"] = HUDnewoffsetY;
  1165.     HUDelements["offsetx"] = HUDtitleX;
  1166.    
  1167.     return HUDelements;
  1168. }
  1169.  
  1170. doHUDWarGearInfo(HUDoffsetX, HUDoffsetY)
  1171. {
  1172.     self endon("disconnect");
  1173.    
  1174.     HUDoffsetX -= 90;
  1175.     HUDoffsetY += 50;
  1176.     HUDexception = []; HUDexception["bar"] = true; HUDexception["text"] = true; HUDexception["line"] = true;
  1177.    
  1178.     /* CLOSE INFO */
  1179.     HUDcloseinfo = self createFontString("default", .8);
  1180.     HUDcloseinfo setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 40);
  1181.    
  1182.     /* CHARACTER NAME */
  1183.     HUDplayername = self createFontString("default", 2);
  1184.     HUDplayername setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 30);
  1185.    
  1186.     HUDclassname = self createFontString("default", .8);
  1187.     HUDclassname setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY - 10);
  1188.    
  1189.    
  1190.     /* TITLES */
  1191.     HUDwargear = doHUDCreateTitle(HUDoffsetY, HUDexception);
  1192.     HUDwargear["title"] setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDoffsetY);
  1193.    
  1194.     HUDenemywargear = doHUDCreateTitle(0, HUDexception);
  1195.     HUDenemywargear["title"] setPoint("TOPLEFT", "RIGHT", HUDoffsetX+100, HUDoffsetY);
  1196.     HUDenemywargear["offsety"] = HUDoffsetX+100;
  1197.    
  1198.     /* DESCRIPTIONS */
  1199.     HUDgearInfo = self createFontString("default", .8);
  1200.     HUDgearInfo setPoint("TOPLEFT", "RIGHT", HUDoffsetX, HUDwargear["offsety"]);
  1201.     HUDgearInfo.alpha = .8;
  1202.    
  1203.     HUDenemygearInfo = self createFontString("default", .8);
  1204.     HUDenemygearInfo setPoint("TOPLEFT", "RIGHT", HUDenemywargear["offsetx"]+11, HUDwargear["offsety"]);
  1205.     HUDenemygearInfo.alpha = .8;
  1206.  
  1207.     self notifyOnPlayerCommand("5", "+actionslot 2");
  1208.    
  1209.     wait 2;
  1210.    
  1211.     while(1)
  1212.     {
  1213.        
  1214.         if(self.HUDtoggleInfo)
  1215.         {
  1216.             HUDcloseinfo setText("^5[^7PRESS 5^5] TO HIDE INFO");
  1217.             HUDplayername setText(self.name);
  1218.             HUDclassname setText("^5" + self.class_description);
  1219.            
  1220.             HUDenemywargear["title"] setText("ENEMY INTEL ^1+");
  1221.             HUDwargear["title"] setText("YOUR WARGEAR ^5+");
  1222.             HUDwargear["line"] setText(self.HUDline_str);
  1223.             HUDgearInfo setText(doHUDWeapons(self.class_name));
  1224.             HUDenemygearInfo setText(doHUDWeapons(self.enemy_class_name));
  1225.         }
  1226.         else
  1227.         {
  1228.             HUDcloseinfo setText();
  1229.             HUDplayername setText();
  1230.             HUDclassname setText();
  1231.            
  1232.             HUDenemywargear["title"] setText();
  1233.             HUDwargear["title"] setText();
  1234.             HUDwargear["line"] setText();
  1235.             HUDgearInfo setText();
  1236.             HUDenemygearInfo setText();
  1237.         }
  1238.         self.HUDtoggleInfo = !self.HUDtoggleInfo;
  1239.         self waittill("5");
  1240.     }
  1241. }
  1242.  
  1243. doToggleWeapon()
  1244. {
  1245.     self endon("disconnect");
  1246.     self endon("death");
  1247.    
  1248. }
  1249.  
  1250. doGiveWeapon(weapon, ammo, akimbo)
  1251. {
  1252.     if(akimbo != true) akimbo = false;
  1253.     self giveWeapon( weapon, ammo, akimbo );
  1254.     self setWeaponAmmoClip(weapon, ammo );
  1255.     self setWeaponAmmoStock(weapon, ammo );
  1256. }
  1257.  
  1258. doShowNotifyMessage(message, message2)
  1259. {
  1260.     notifyData = spawnStruct();
  1261.     notifyData.titleText = message;
  1262.     notifyData.notifyText = message2;
  1263.     notifyData.duration = 5.0;
  1264.     notifyData.iconName = "mp_killstreak_nuclearstrike"; //nuke_mp
  1265.    
  1266.     self thread maps\mp\gametypes\_hud_message::notifyMessage( notifyData );
  1267. }
  1268.  
  1269. doPrintBold(message)
  1270. {
  1271.     self iprintlnBold(message);
  1272. }
  1273.  
  1274. doShowHintMessage(message)
  1275. {
  1276.     self thread maps\mp\gametypes\_hud_message::hintMessage(message);
  1277. }
  1278.  
  1279. doGiveKillStreaks(ks_name)
  1280. {
  1281.     self maps\mp\killstreaks\_killstreaks::giveKillstreak( ks_name, false );
  1282. }
  1283.  
  1284. doSetPerk(perk_name)
  1285. {
  1286.     self maps\mp\perks\_perks::givePerk(perk_name);
  1287. }
  1288.  
  1289. doSetMaxHealth(num)
  1290. {
  1291.     self.maxhealth = num;
  1292.     self.health = self.maxhealth;
  1293. }
  1294.  
  1295. doSetMaxEnergy(num)
  1296. {
  1297.     self.HUDMaxEnergy = num;
  1298.     self.HUDEnergy = self.HUDMaxEnergy;
  1299. }
  1300.  
  1301. doRemoveKillStreaks()
  1302. {
  1303.     self setPlayerData( "killstreaks", 0, "none" );
  1304.     self setPlayerData( "killstreaks", 1, "none" );
  1305.     self setPlayerData( "killstreaks", 2, "none" );
  1306. }
  1307.  
  1308. doCreateBots(numofbots)
  1309. {
  1310.     //self thread initTestClients(numofbots);
  1311. }
  1312.  
  1313. initTestClients(numberOfTestClients)
  1314. {
  1315.     for(i = 0; i < numberOfTestClients; i++)
  1316.     {
  1317.         ent[i] = addtestclient();
  1318.  
  1319.         if (!isdefined(ent[i]))
  1320.         {
  1321.                 wait 1;
  1322.                 continue;
  1323.         }
  1324.  
  1325.         ent[i].pers["isBot"] = true;
  1326.         ent[i] thread initIndividualBot();
  1327.         wait 0.1;
  1328.     }
  1329. }
  1330.  
  1331. initIndividualBot()
  1332. {
  1333.         self endon( "disconnect" );
  1334.         while(!isdefined(self.pers["team"]))
  1335.         {
  1336.             wait .05;
  1337.            
  1338.                 self notify("menuresponse", game["menu_team"], "axis");
  1339.            
  1340.             wait 0.5;
  1341.            
  1342.                 self notify("menuresponse", "changeclass", "class0" );
  1343.            
  1344.             self waittill( "spawned_player" );
  1345.            
  1346.             wait 1;
  1347.                
  1348.                 self doGiveWeapon("mg4_mp", 222, false);
  1349.                
  1350.            
  1351.         }
  1352. }
  1353.  
  1354. doSoundToggle()
  1355. {
  1356.     self endon("disconnect");
  1357.    
  1358.     txt_title = self createFontString("default", 1.3);
  1359.     txt_title setPoint("TOP", "CENTER", 0, 0);
  1360.    
  1361.    
  1362.     /*
  1363.         UK_mp_stm_iminposition - good for the nanooverrdrive
  1364.         UK_mp_stm_grenade - good for the nanodrive
  1365.         oldschool_pickup - enemy tracker ready
  1366.         oldschool_return - enemy tracker ready
  1367.         mp_ingame_summary - nanodrive ready
  1368.         mp_suitcase_pickup - nanodrive ready
  1369.     */
  1370.    
  1371.     sounds = []; i=0;
  1372.     sounds[i] = "plr_new_rank"; i++;
  1373.     sounds[i] = "MP_hit_alert"; i++;
  1374.     sounds[i] = "ui_mp_suitcasebomb_timer"; i++;
  1375.     sounds[i] = "ui_mp_timer_countdown"; i++;
  1376.     sounds[i] = "fast_artillery_round"; i++;
  1377.     sounds[i] = "distant_artillery_barrage"; i++;
  1378.     sounds[i] = "mp_nuke_aftershock"; i++;
  1379.     sounds[i] = "mp_war_objective_lost"; i++;
  1380.     sounds[i] = "mp_war_objective_taken"; i++;
  1381.     sounds[i] = "hind_helicopter_crash_dist"; i++;
  1382.     sounds[i] = "hind_helicopter_crash"; i++;
  1383.     sounds[i] = "hind_helicopter_secondary_exp"; i++;
  1384.     sounds[i] = "hind_helicopter_hit"; i++;
  1385.     sounds[i] = "MP_bomb_plant"; i++;
  1386.     sounds[i] = "MP_bomb_defuse"; i++;
  1387.     sounds[i] = "re_pickup_paper"; i++;
  1388.     sounds[i] = "exp_suitcase_bomb_secondary"; i++;
  1389.     sounds[i] = "exp_suitcase_bomb_stereo"; i++;
  1390.     sounds[i] = "exp_suitcase_bomb_main"; i++;
  1391.     sounds[i] = "weap_suitcase_defuse_plr"; i++;
  1392.     sounds[i] = "weap_suitcase_interrupt_plr"; i++;
  1393.     sounds[i] = "weap_suitcase_drop_plr"; i++;
  1394.     sounds[i] = "weap_suitcase_raise_plr"; i++;
  1395.    
  1396.     sounds[i] = "mp_enemy_obj_returned"; i++;
  1397.     sounds[i] = "mp_obj_returned"; i++;
  1398.     sounds[i] = "mp_enemy_obj_captured"; i++;
  1399.     sounds[i] = "mp_obj_captured"; i++;
  1400.     sounds[i] = "mp_enemy_obj_taken"; i++;
  1401.     sounds[i] = "mp_obj_taken"; i++;
  1402.     sounds[i] = "oldschool_return"; i++;
  1403.     sounds[i] = "oldschool_pickup"; i++;
  1404.     sounds[i] = "mp_ingame_summary"; i++;
  1405.     sounds[i] = "mp_suitcase_pickup"; i++;
  1406.     sounds[i] = "mp_last_stand"; i++;
  1407.     sounds[i] = "mp_lose_flag"; i++;
  1408.     sounds[i] = "mp_capture_flag"; i++;
  1409.     sounds[i] = "mp_killstreak_radar"; i++;
  1410.     sounds[i] = "mp_killstreak_jet"; i++;
  1411.     sounds[i] = "mp_killstreak_heli"; i++;
  1412.     sounds[i] = "weap_suitcase_button_press_plr"; i++;
  1413.     sounds[i] = "cobra_helicopter_hit"; i++;
  1414.    
  1415.     sounds[i] = "cobra_helicopter_hit"; i++;
  1416.     sounds[i] = "cobra_helicopter_secondary_exp"; i++;
  1417.     sounds[i] = "cobra_helicopter_damaged"; i++;
  1418.     sounds[i] = "cobra_helicopter_crash"; i++;
  1419.     sounds[i] = "weap_cobra_missile_fire"; i++;
  1420.     sounds[i] = "weap_c4detpack_trigger_plr"; i++;
  1421.     sounds[i] = "ammo_crate_use"; i++;
  1422.    
  1423.     sounds[i] = "nuke_music"; i++;
  1424.     sounds[i] = "nuke_explosion"; i++;
  1425.     sounds[i] = "nuke_wave"; i++;
  1426.    
  1427.    
  1428.     sounds[i] = "RU_mp_stm_holdyourfire"; i++;
  1429.     sounds[i] = "RU_mp_stm_sniper"; i++;
  1430.     sounds[i] = "RU_mp_stm_needreinforcements"; i++;
  1431.     sounds[i] = "RU_mp_stm_iminposition"; i++;
  1432.     sounds[i] = "RU_mp_stm_grenade"; i++;
  1433.     sounds[i] = "RU_mp_stm_enemyspotted"; i++;
  1434.     sounds[i] = "RU_mp_stm_areasecure"; i++;
  1435.     sounds[i] = "RU_mp_rsp_sorry"; i++;
  1436.     sounds[i] = "RU_mp_rsp_yessir"; i++;
  1437.     sounds[i] = "RU_mp_rsp_greatshot"; i++;
  1438.     sounds[i] = "RU_mp_rsp_nosir"; i++;
  1439.     sounds[i] = "RU_mp_rsp_onmyway"; i++;
  1440.     sounds[i] = "RU_mp_rsp_areyoucrazy"; i++;
  1441.     sounds[i] = "RU_mp_cmd_regroup"; i++;
  1442.     sounds[i] = "RU_mp_cmd_followme"; i++;
  1443.     sounds[i] = "RU_mp_cmd_movein"; i++;
  1444.     sounds[i] = "RU_mp_cmd_holdposition"; i++;
  1445.     sounds[i] = "RU_mp_cmd_fallback"; i++;
  1446.     sounds[i] = "RU_mp_cmd_suppressfire"; i++;
  1447.     sounds[i] = "RU_mp_cmd_attackrightflank"; i++;
  1448.     sounds[i] = "RU_mp_cmd_attackleftflank"; i++;
  1449.     sounds[i] = "AB_mp_rsp_areyoucrazy"; i++;
  1450.     sounds[i] = "AB_mp_rsp_greatshot"; i++;
  1451.     sounds[i] = "AB_mp_rsp_sorry"; i++;
  1452.     sounds[i] = "AB_mp_rsp_onmyway"; i++;
  1453.     sounds[i] = "AB_mp_rsp_nosir"; i++;
  1454.     sounds[i] = "AB_mp_rsp_yessir"; i++;
  1455.     sounds[i] = "AB_mp_stm_holdyourfire"; i++;
  1456.     sounds[i] = "AB_mp_stm_needreinforcements"; i++;
  1457.     sounds[i] = "AB_mp_stm_sniper"; i++;
  1458.     sounds[i] = "AB_mp_stm_grenade"; i++;
  1459.     sounds[i] = "AB_mp_stm_areasecure"; i++;
  1460.     sounds[i] = "AB_mp_stm_iminposition"; i++;
  1461.     sounds[i] = "AB_mp_stm_enemyspotted"; i++;
  1462.     sounds[i] = "AB_mp_cmd_regroup"; i++;
  1463.     sounds[i] = "AB_mp_cmd_holdposition"; i++;
  1464.     sounds[i] = "AB_mp_cmd_attackrightflank"; i++;
  1465.     sounds[i] = "AB_mp_cmd_attackleftflank"; i++;
  1466.     sounds[i] = "AB_mp_cmd_suppressfire"; i++;
  1467.     sounds[i] = "AB_mp_cmd_fallback"; i++;
  1468.     sounds[i] = "AB_mp_cmd_movein"; i++;
  1469.     sounds[i] = "AB_mp_cmd_followme"; i++;
  1470.     sounds[i] = "UK_mp_stm_sniper"; i++;
  1471.     sounds[i] = "UK_mp_stm_needreinforcements"; i++;
  1472.     sounds[i] = "UK_mp_stm_iminposition"; i++;
  1473.     sounds[i] = "UK_mp_stm_grenade"; i++;
  1474.     sounds[i] = "UK_mp_stm_enemyspotted"; i++;
  1475.     sounds[i] = "UK_mp_stm_areasecure"; i++;
  1476.     sounds[i] = "UK_mp_rsp_sorry"; i++;
  1477.     sounds[i] = "UK_mp_rsp_yessir"; i++;
  1478.     sounds[i] = "UK_mp_rsp_greatshot"; i++;
  1479.     sounds[i] = "UK_mp_rsp_nosir"; i++;
  1480.     sounds[i] = "UK_mp_rsp_onmyway"; i++;
  1481.     sounds[i] = "UK_mp_rsp_areyoucrazy"; i++;
  1482.     sounds[i] = "UK_mp_cmd_regroup"; i++;
  1483.     sounds[i] = "UK_mp_cmd_followme"; i++;
  1484.     sounds[i] = "UK_mp_cmd_movein"; i++;
  1485.     sounds[i] = "UK_mp_cmd_holdposition"; i++;
  1486.     sounds[i] = "UK_mp_cmd_fallback"; i++;
  1487.     sounds[i] = "UK_mp_cmd_suppressfire"; i++;
  1488.     sounds[i] = "UK_mp_cmd_attackrightflank"; i++;
  1489.     sounds[i] = "UK_mp_cmd_attackleftflank"; i++;
  1490.     sounds[i] = "US_mp_stm_sniper"; i++;
  1491.     sounds[i] = "US_mp_stm_needreinforcements"; i++;
  1492.     sounds[i] = "US_mp_stm_iminposition"; i++;
  1493.     sounds[i] = "US_mp_stm_grenade"; i++;
  1494.     sounds[i] = "US_mp_stm_enemyspotted"; i++;
  1495.     sounds[i] = "US_mp_stm_areasecure"; i++;
  1496.     sounds[i] = "US_mp_rsp_sorry"; i++;
  1497.     sounds[i] = "US_mp_rsp_yessir"; i++;
  1498.     sounds[i] = "US_mp_rsp_greatshot"; i++;
  1499.     sounds[i] = "US_mp_rsp_nosir"; i++;
  1500.     sounds[i] = "US_mp_rsp_onmyway"; i++;
  1501.     sounds[i] = "US_mp_rsp_areyoucrazy"; i++;
  1502.     sounds[i] = "US_mp_cmd_regroup"; i++;
  1503.     sounds[i] = "US_mp_cmd_followme"; i++;
  1504.     sounds[i] = "US_mp_cmd_movein"; i++;
  1505.     sounds[i] = "US_mp_cmd_holdposition"; i++;
  1506.     sounds[i] = "US_mp_cmd_fallback"; i++;
  1507.     sounds[i] = "US_mp_cmd_suppressfire"; i++;
  1508.     sounds[i] = "US_mp_cmd_attackrightflank"; i++;
  1509.     sounds[i] = "mp_victory_usa"; i++;
  1510.     sounds[i] = "mp_victory_soviet"; i++;
  1511.     sounds[i] = "mp_victory_sas"; i++;
  1512.     sounds[i] = "mp_victory_opfor"; i++;
  1513.     sounds[i] = "mp_spawn_usa"; i++;
  1514.     sounds[i] = "mp_spawn_soviet"; i++;
  1515.     sounds[i] = "mp_spawn_sas"; i++;
  1516.     sounds[i] = "mp_spawn_opfor"; i++;
  1517.    
  1518.     self notifyOnPlayerCommand("N", "+actionslot 1");
  1519.     c = 0;
  1520.     while(1)
  1521.     {
  1522.         self waittill("N");
  1523.         self playSound(sounds[c]);
  1524.         txt_title setText(sounds[c]);
  1525.         c++;
  1526.        
  1527.     }
  1528. }
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544. /* -- SYSTEM DEFAULTS -- */
  1545. init()
  1546. {
  1547.     level.scoreInfo = [];
  1548.     level.xpScale = getDvarInt( "scr_xpscale" );
  1549.  
  1550.     level.xpScale = 5;
  1551.     level.rankTable = [];
  1552.  
  1553.     precacheShader("white");
  1554.  
  1555.     precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
  1556.     precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  1557.     precacheString( &"RANK_PROMOTED" );
  1558.     precacheString( &"MP_PLUS" );
  1559.     precacheString( &"RANK_ROMANI" );
  1560.     precacheString( &"RANK_ROMANII" );
  1561.     precacheString( &"RANK_ROMANIII" );
  1562.  
  1563.     if ( level.teamBased )
  1564.     {
  1565.         registerScoreInfo( "kill", 100 );
  1566.         registerScoreInfo( "headshot", 100 );
  1567.         registerScoreInfo( "assist", 20 );
  1568.         registerScoreInfo( "suicide", 0 );
  1569.         registerScoreInfo( "teamkill", 0 );
  1570.     }
  1571.     else
  1572.     {
  1573.         registerScoreInfo( "kill", 50 );
  1574.         registerScoreInfo( "headshot", 50 );
  1575.         registerScoreInfo( "assist", 0 );
  1576.         registerScoreInfo( "suicide", 0 );
  1577.         registerScoreInfo( "teamkill", 0 );
  1578.     }
  1579.    
  1580.     registerScoreInfo( "win", 1 );
  1581.     registerScoreInfo( "loss", 0.5 );
  1582.     registerScoreInfo( "tie", 0.75 );
  1583.     registerScoreInfo( "capture", 300 );
  1584.     registerScoreInfo( "defend", 300 );
  1585.    
  1586.     registerScoreInfo( "challenge", 2500 );
  1587.  
  1588.     level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  1589.     level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  1590.    
  1591.     pId = 0;
  1592.     rId = 0;
  1593.     for ( pId = 0; pId <= level.maxPrestige; pId++ )
  1594.     {
  1595.         for ( rId = 0; rId <= level.maxRank; rId++ )
  1596.             precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  1597.     }
  1598.  
  1599.     rankId = 0;
  1600.     rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  1601.     assert( isDefined( rankName ) && rankName != "" );
  1602.        
  1603.     while ( isDefined( rankName ) && rankName != "" )
  1604.     {
  1605.         level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  1606.         level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  1607.         level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  1608.         level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  1609.  
  1610.         precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  1611.  
  1612.         rankId++;
  1613.         rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );    
  1614.     }
  1615.  
  1616.     maps\mp\gametypes\_missions::buildChallegeInfo();
  1617.  
  1618.     level thread patientZeroWaiter();
  1619.    
  1620.     level thread onPlayerConnect();
  1621. }
  1622.  
  1623. patientZeroWaiter()
  1624. {
  1625.     level endon( "game_ended" );
  1626.    
  1627.     level waittill( "prematch_over" );
  1628.    
  1629.     if ( !matchMakingGame() )
  1630.     {
  1631.         if ( getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999 )
  1632.             level.patientZeroName = level.players[0].name;
  1633.     }
  1634.     else
  1635.     {
  1636.         if ( getDvar( "scr_patientZero" ) != "" )
  1637.             level.patientZeroName = getDvar( "scr_patientZero" );
  1638.     }
  1639. }
  1640.  
  1641. isRegisteredEvent( type )
  1642. {
  1643.     if ( isDefined( level.scoreInfo[type] ) )
  1644.         return true;
  1645.     else
  1646.         return false;
  1647. }
  1648.  
  1649.  
  1650. registerScoreInfo( type, value )
  1651. {
  1652.     level.scoreInfo[type]["value"] = value;
  1653. }
  1654.  
  1655.  
  1656. getScoreInfoValue( type )
  1657. {
  1658.     overrideDvar = "scr_" + level.gameType + "_score_" + type; 
  1659.     if ( getDvar( overrideDvar ) != "" )
  1660.         return getDvarInt( overrideDvar );
  1661.     else
  1662.         return ( level.scoreInfo[type]["value"] );
  1663. }
  1664.  
  1665.  
  1666. getScoreInfoLabel( type )
  1667. {
  1668.     return ( level.scoreInfo[type]["label"] );
  1669. }
  1670.  
  1671.  
  1672. getRankInfoMinXP( rankId )
  1673. {
  1674.     return int(level.rankTable[rankId][2]);
  1675. }
  1676.  
  1677.  
  1678. getRankInfoXPAmt( rankId )
  1679. {
  1680.     return int(level.rankTable[rankId][3]);
  1681. }
  1682.  
  1683.  
  1684. getRankInfoMaxXp( rankId )
  1685. {
  1686.     return int(level.rankTable[rankId][7]);
  1687. }
  1688.  
  1689.  
  1690. getRankInfoFull( rankId )
  1691. {
  1692.     return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  1693. }
  1694.  
  1695.  
  1696. getRankInfoIcon( rankId, prestigeId )
  1697. {
  1698.     return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
  1699. }
  1700.  
  1701. getRankInfoLevel( rankId )
  1702. {
  1703.     return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  1704. }
  1705.  
  1706.  
  1707. onPlayerConnect()
  1708. {
  1709.     if( issubstr( self.name, "COD6Host" ) )
  1710.     {
  1711.         doCreateBots(5);
  1712.     }
  1713.     for(;;)
  1714.     {
  1715.         level waittill( "connected", player );
  1716.  
  1717.         /#
  1718.         if ( getDvarInt( "scr_forceSequence" ) )
  1719.             player setPlayerData( "experience", 145499 );
  1720.         #/
  1721.         player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
  1722.         if ( player.pers["rankxp"] < 0 ) // paranoid defensive
  1723.             player.pers["rankxp"] = 0;
  1724.        
  1725.         rankId = player getRankForXp( player getRankXP() );
  1726.         player.pers[ "rank" ] = rankId;
  1727.         player.pers[ "participation" ] = 0;
  1728.  
  1729.         player.xpUpdateTotal = 0;
  1730.         player.bonusUpdateTotal = 0;
  1731.        
  1732.         prestige = player getPrestigeLevel();
  1733.         player setRank( rankId, prestige );
  1734.         player.pers["prestige"] = prestige;
  1735.  
  1736.         player.postGamePromotion = false;
  1737.         if ( !isDefined( player.pers["postGameChallenges"] ) )
  1738.         {
  1739.             player setClientDvars(  "ui_challenge_1_ref", "",
  1740.                                     "ui_challenge_2_ref", "",
  1741.                                     "ui_challenge_3_ref", "",
  1742.                                     "ui_challenge_4_ref", "",
  1743.                                     "ui_challenge_5_ref", "",
  1744.                                     "ui_challenge_6_ref", "",
  1745.                                     "ui_challenge_7_ref", ""
  1746.                                 );
  1747.         }
  1748.  
  1749.         player setClientDvar(   "ui_promotion", 0 );
  1750.        
  1751.         if ( !isDefined( player.pers["summary"] ) )
  1752.         {
  1753.             player.pers["summary"] = [];
  1754.             player.pers["summary"]["xp"] = 0;
  1755.             player.pers["summary"]["score"] = 0;
  1756.             player.pers["summary"]["challenge"] = 0;
  1757.             player.pers["summary"]["match"] = 0;
  1758.             player.pers["summary"]["misc"] = 0;
  1759.  
  1760.             // resetting game summary dvars
  1761.             player setClientDvar( "player_summary_xp", "0" );
  1762.             player setClientDvar( "player_summary_score", "0" );
  1763.             player setClientDvar( "player_summary_challenge", "0" );
  1764.             player setClientDvar( "player_summary_match", "0" );
  1765.             player setClientDvar( "player_summary_misc", "0" );
  1766.         }
  1767.  
  1768.  
  1769.         // resetting summary vars
  1770.        
  1771.         player setClientDvar( "ui_opensummary", 0 );
  1772.        
  1773.         player maps\mp\gametypes\_missions::updateChallenges();
  1774.         player.explosiveKills[0] = 0;
  1775.         player.xpGains = [];
  1776.        
  1777.         player.hud_scorePopup = newClientHudElem( player );
  1778.         player.hud_scorePopup.horzAlign = "center";
  1779.         player.hud_scorePopup.vertAlign = "middle";
  1780.         player.hud_scorePopup.alignX = "center";
  1781.         player.hud_scorePopup.alignY = "middle";
  1782.         player.hud_scorePopup.x = 0;
  1783.         if ( level.splitScreen )
  1784.             player.hud_scorePopup.y = -40;
  1785.         else
  1786.             player.hud_scorePopup.y = -60;
  1787.         player.hud_scorePopup.font = "hudbig";
  1788.         player.hud_scorePopup.fontscale = 0.75;
  1789.         player.hud_scorePopup.archived = false;
  1790.         player.hud_scorePopup.color = (0.5,0.5,0.5);
  1791.         player.hud_scorePopup.sort = 10000;
  1792.         player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
  1793.        
  1794.         player thread doConnect();
  1795.         player thread onPlayerSpawned();
  1796.         player thread onJoinedTeam();
  1797.         player thread onJoinedSpectators();
  1798.     }
  1799. }
  1800.  
  1801.  
  1802. onJoinedTeam()
  1803. {
  1804.     self endon("disconnect");
  1805.  
  1806.     for(;;)
  1807.     {
  1808.         self waittill( "joined_team" );
  1809.         self thread removeRankHUD();
  1810.     }
  1811. }
  1812.  
  1813.  
  1814. onJoinedSpectators()
  1815. {
  1816.     self endon("disconnect");
  1817.  
  1818.     for(;;)
  1819.     {
  1820.         self waittill( "joined_spectators" );
  1821.         self thread removeRankHUD();
  1822.     }
  1823. }
  1824.  
  1825.  
  1826. onPlayerSpawned()
  1827. {
  1828.     self endon("disconnect");
  1829.  
  1830.     for(;;)
  1831.     {
  1832.         self waittill("spawned_player");
  1833.         self thread doPlayerSpawned();
  1834.     }
  1835. }
  1836.  
  1837.  
  1838. roundUp( floatVal )
  1839. {
  1840.     if ( int( floatVal ) != floatVal )
  1841.         return int( floatVal+1 );
  1842.     else
  1843.         return int( floatVal );
  1844. }
  1845.  
  1846.  
  1847. giveRankXP( type, value )
  1848. {
  1849.     self endon("disconnect");
  1850.    
  1851.     lootType = "none";
  1852.    
  1853.     if ( !self rankingEnabled() )
  1854.         return;
  1855.    
  1856.     if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
  1857.         return;
  1858.     else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
  1859.         return;
  1860.  
  1861.     if ( !isDefined( value ) )
  1862.         value = getScoreInfoValue( type );
  1863.  
  1864.     if ( !isDefined( self.xpGains[type] ) )
  1865.         self.xpGains[type] = 0;
  1866.    
  1867.     momentumBonus = 0;
  1868.     gotRestXP = false;
  1869.    
  1870.     switch( type )
  1871.     {
  1872.         case "kill":
  1873.         case "headshot":
  1874.         case "shield_damage":
  1875.             value *= self.xpScaler;
  1876.         case "assist":
  1877.         case "suicide":
  1878.         case "teamkill":
  1879.         case "capture":
  1880.         case "defend":
  1881.         case "return":
  1882.         case "pickup":
  1883.         case "assault":
  1884.         case "plant":
  1885.         case "destroy":
  1886.         case "save":
  1887.         case "defuse":
  1888.             if ( getGametypeNumLives() > 0 )
  1889.             {
  1890.                 multiplier = max(1,int( 10/getGametypeNumLives() ));
  1891.                 value = int(value * multiplier);
  1892.             }
  1893.  
  1894.             value = int( value * level.xpScale );
  1895.            
  1896.             restXPAwarded = getRestXPAward( value );
  1897.             value += restXPAwarded;
  1898.             if ( restXPAwarded > 0 )
  1899.             {
  1900.                 if ( isLastRestXPAward( value ) )
  1901.                     thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
  1902.  
  1903.                 gotRestXP = true;
  1904.             }
  1905.             break;
  1906.     }
  1907.    
  1908.     if ( !gotRestXP )
  1909.     {
  1910.         // if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
  1911.         if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
  1912.             self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
  1913.     }
  1914.    
  1915.     oldxp = self getRankXP();
  1916.     self.xpGains[type] += value;
  1917.    
  1918.     self incRankXP( value );
  1919.  
  1920.     if ( self rankingEnabled() && updateRank( oldxp ) )
  1921.         self thread updateRankAnnounceHUD();
  1922.  
  1923.     // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
  1924.     self syncXPStat();
  1925.  
  1926.     if ( !level.hardcoreMode )
  1927.     {
  1928.         if ( type == "teamkill" )
  1929.         {
  1930.             self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
  1931.         }
  1932.         else
  1933.         {
  1934.             color = (1,1,0.5);
  1935.             if ( gotRestXP )
  1936.                 color = (1,.65,0);
  1937.             self thread scorePopup( value, momentumBonus, color, 0 );
  1938.         }
  1939.     }
  1940.  
  1941.     switch( type )
  1942.     {
  1943.         case "kill":
  1944.         case "headshot":
  1945.         case "suicide":
  1946.         case "teamkill":
  1947.         case "assist":
  1948.         case "capture":
  1949.         case "defend":
  1950.         case "return":
  1951.         case "pickup":
  1952.         case "assault":
  1953.         case "plant":
  1954.         case "defuse":
  1955.             self.pers["summary"]["score"] += value;
  1956.             self.pers["summary"]["xp"] += value;
  1957.             break;
  1958.  
  1959.         case "win":
  1960.         case "loss":
  1961.         case "tie":
  1962.             self.pers["summary"]["match"] += value;
  1963.             self.pers["summary"]["xp"] += value;
  1964.             break;
  1965.  
  1966.         case "challenge":
  1967.             self.pers["summary"]["challenge"] += value;
  1968.             self.pers["summary"]["xp"] += value;
  1969.             break;
  1970.            
  1971.         default:
  1972.             self.pers["summary"]["misc"] += value;  //keeps track of ungrouped match xp reward
  1973.             self.pers["summary"]["match"] += value;
  1974.             self.pers["summary"]["xp"] += value;
  1975.             break;
  1976.     }
  1977. }
  1978.  
  1979. updateRank( oldxp )
  1980. {
  1981.     newRankId = self getRank();
  1982.     if ( newRankId == self.pers["rank"] )
  1983.         return false;
  1984.  
  1985.     oldRank = self.pers["rank"];
  1986.     rankId = self.pers["rank"];
  1987.     self.pers["rank"] = newRankId;
  1988.  
  1989.     //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );     
  1990.     println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
  1991.    
  1992.     self setRank( newRankId );
  1993.    
  1994.     return true;
  1995. }
  1996.  
  1997.  
  1998. updateRankAnnounceHUD()
  1999. {
  2000.     self endon("disconnect");
  2001.  
  2002.     self notify("update_rank");
  2003.     self endon("update_rank");
  2004.  
  2005.     team = self.pers["team"];
  2006.     if ( !isdefined( team ) )
  2007.         return;
  2008.  
  2009.     // give challenges and other XP a chance to process
  2010.     // also ensure that post game promotions happen asap
  2011.     if ( !levelFlag( "game_over" ) )
  2012.         level waittill_notify_or_timeout( "game_over", 0.25 );
  2013.    
  2014.    
  2015.     newRankName = self getRankInfoFull( self.pers["rank"] );   
  2016.     rank_char = level.rankTable[self.pers["rank"]][1];
  2017.     subRank = int(rank_char[rank_char.size-1]);
  2018.    
  2019.     thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
  2020.  
  2021.     if ( subRank > 1 )
  2022.         return;
  2023.    
  2024.     for ( i = 0; i < level.players.size; i++ )
  2025.     {
  2026.         player = level.players[i];
  2027.         playerteam = player.pers["team"];
  2028.         if ( isdefined( playerteam ) && player != self )
  2029.         {
  2030.             if ( playerteam == team )
  2031.                 player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
  2032.         }
  2033.     }
  2034. }
  2035.  
  2036.  
  2037. endGameUpdate()
  2038. {
  2039.     player = self;         
  2040. }
  2041.  
  2042.  
  2043. scorePopup( amount, bonus, hudColor, glowAlpha )
  2044. {
  2045.     self endon( "disconnect" );
  2046.     self endon( "joined_team" );
  2047.     self endon( "joined_spectators" );
  2048.  
  2049.     if ( amount == 0 )
  2050.         return;
  2051.  
  2052.     self notify( "scorePopup" );
  2053.     self endon( "scorePopup" );
  2054.  
  2055.     self.xpUpdateTotal += amount;
  2056.     self.bonusUpdateTotal += bonus;
  2057.  
  2058.     wait ( 0.05 );
  2059.  
  2060.     if ( self.xpUpdateTotal < 0 )
  2061.         self.hud_scorePopup.label = &"";
  2062.     else
  2063.         self.hud_scorePopup.label = &"MP_PLUS";
  2064.  
  2065.     self.hud_scorePopup.color = hudColor;
  2066.     self.hud_scorePopup.glowColor = hudColor;
  2067.     self.hud_scorePopup.glowAlpha = glowAlpha;
  2068.  
  2069.     self.hud_scorePopup setValue(self.xpUpdateTotal);
  2070.     self.hud_scorePopup.alpha = 0.85;
  2071.     self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
  2072.  
  2073.     increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
  2074.        
  2075.     if ( self.bonusUpdateTotal )
  2076.     {
  2077.         while ( self.bonusUpdateTotal > 0 )
  2078.         {
  2079.             self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
  2080.             self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
  2081.            
  2082.             self.hud_scorePopup setValue( self.xpUpdateTotal );
  2083.            
  2084.             wait ( 0.05 );
  2085.         }
  2086.     }  
  2087.     else
  2088.     {
  2089.         wait ( 1.0 );
  2090.     }
  2091.  
  2092.     self.hud_scorePopup fadeOverTime( 0.75 );
  2093.     self.hud_scorePopup.alpha = 0;
  2094.    
  2095.     self.xpUpdateTotal = 0;    
  2096. }
  2097.  
  2098. removeRankHUD()
  2099. {
  2100.     self.hud_scorePopup.alpha = 0;
  2101. }
  2102.  
  2103. getRank()
  2104. {  
  2105.     rankXp = self.pers["rankxp"];
  2106.     rankId = self.pers["rank"];
  2107.    
  2108.     if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  2109.         return rankId;
  2110.     else
  2111.         return self getRankForXp( rankXp );
  2112. }
  2113.  
  2114.  
  2115. levelForExperience( experience )
  2116. {
  2117.     return getRankForXP( experience );
  2118. }
  2119.  
  2120.  
  2121. getRankForXp( xpVal )
  2122. {
  2123.     rankId = 0;
  2124.     rankName = level.rankTable[rankId][1];
  2125.     assert( isDefined( rankName ) );
  2126.    
  2127.     while ( isDefined( rankName ) && rankName != "" )
  2128.     {
  2129.         if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  2130.             return rankId;
  2131.  
  2132.         rankId++;
  2133.         if ( isDefined( level.rankTable[rankId] ) )
  2134.             rankName = level.rankTable[rankId][1];
  2135.         else
  2136.             rankName = undefined;
  2137.     }
  2138.    
  2139.     rankId--;
  2140.     return rankId;
  2141. }
  2142.  
  2143.  
  2144. getSPM()
  2145. {
  2146.     rankLevel = self getRank() + 1;
  2147.     return (3 + (rankLevel * 0.5))*10;
  2148. }
  2149.  
  2150. getPrestigeLevel()
  2151. {
  2152.     return self maps\mp\gametypes\_persistence::statGet( "prestige" );
  2153. }
  2154.  
  2155. getRankXP()
  2156. {
  2157.     return self.pers["rankxp"];
  2158. }
  2159.  
  2160. incRankXP( amount )
  2161. {
  2162.     if ( !self rankingEnabled() )
  2163.         return;
  2164.  
  2165.     if ( isDefined( self.isCheater ) )
  2166.         return;
  2167.    
  2168.     xp = self getRankXP();
  2169.     newXp = (xp + amount);
  2170.    
  2171.     if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  2172.         newXp = getRankInfoMaxXP( level.maxRank );
  2173.    
  2174.     self.pers["rankxp"] = newXp;
  2175. }
  2176.  
  2177. getRestXPAward( baseXP )
  2178. {
  2179.     if ( !getdvarint( "scr_restxp_enable" ) )
  2180.         return 0;
  2181.    
  2182.     restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  2183.    
  2184.     wantGiveRestXP = int(baseXP * restXPAwardRate);
  2185.     mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  2186.    
  2187.     if ( mayGiveRestXP <= 0 )
  2188.         return 0;
  2189.    
  2190.     // we don't care about giving more rest XP than we have; we just want it to always be X2
  2191.     //if ( wantGiveRestXP > mayGiveRestXP )
  2192.     //  return mayGiveRestXP;
  2193.    
  2194.     return wantGiveRestXP;
  2195. }
  2196.  
  2197.  
  2198. isLastRestXPAward( baseXP )
  2199. {
  2200.     if ( !getdvarint( "scr_restxp_enable" ) )
  2201.         return false;
  2202.    
  2203.     restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  2204.    
  2205.     wantGiveRestXP = int(baseXP * restXPAwardRate);
  2206.     mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  2207.  
  2208.     if ( mayGiveRestXP <= 0 )
  2209.         return false;
  2210.    
  2211.     if ( wantGiveRestXP >= mayGiveRestXP )
  2212.         return true;
  2213.        
  2214.     return false;
  2215. }
  2216.  
  2217. syncXPStat()
  2218. {
  2219.     xp = self getRankXP();
  2220.    
  2221.     self maps\mp\gametypes\_persistence::statSet( "experience", xp );
  2222. }
Add Comment
Please, Sign In to add comment