Guest User

Untitled

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