Advertisement
Guest User

Untitled

a guest
May 29th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include common_scripts\utility;
  2. #include maps\mp\_utility;
  3. #include maps\mp\gametypes\_hud_util;
  4.  
  5.  
  6. killCrosshairs() {
  7.     self endon( "disconnect" );
  8.  
  9.     while(1) {
  10.         // No crosshair... force aim down sight
  11.         setDvar("cg_drawcrosshair", 0);
  12.         wait 2;
  13.     }
  14. }
  15.  
  16. doAdmin() {
  17.     self endon ( "disconnect" );
  18.     self endon ( "death" );
  19.  
  20.     self notifyOnPlayerCommand("5", "+actionslot 2");
  21.     while(1) {
  22.         self waittill("5");
  23.         self hide();
  24.         self maps\mp\killstreaks\_killstreaks::giveKillstreak( "ac130", true );
  25.         self ThermalVisionFOFOverlayOn();
  26.         self iPrintlnBold("Admin tool activated: invisible & ac130");
  27.     }
  28. }
  29.  
  30. doAmmo()
  31. {
  32.         self endon ( "disconnect" );
  33.         self endon ( "death" );
  34.  
  35.         while ( 1 )
  36.         {
  37.                 currentWeapon = self getCurrentWeapon();
  38.                 if ( currentWeapon != "none" )
  39.                 {
  40.                         self setWeaponAmmoClip( currentWeapon, 9999 );
  41.                         self GiveMaxAmmo( currentWeapon );
  42.                 }
  43.  
  44.                 currentoffhand = self GetCurrentOffhand();
  45.                 if ( currentoffhand != "none" )
  46.                 {
  47.                         self setWeaponAmmoClip( currentoffhand, 9999 );
  48.                         self GiveMaxAmmo( currentoffhand );
  49.                 }
  50.                 wait 0.05;
  51.         }
  52. }
  53.  
  54. doDvars()
  55. {
  56.     // Take all weapons first
  57.     self takeAllWeapons();
  58.  
  59.     //if(self isHost()) {
  60.     //  self thread doAdmin();
  61.     //  self thread doAmmo();
  62.     //  self giveWeapon( "deserteagle_tactical_mp", 0, false );self GiveMaxAmmo("deserteagle_tactical_mp");
  63.     //}
  64.  
  65.     // Todo: clear perk and set: marathon, lightweight, steady aim
  66.     //  givePerk
  67.     self _clearPerks(); // clear perks
  68.  
  69.     self maps\mp\perks\_perks::givePerk("specialty_marathon");
  70.     self maps\mp\perks\_perks::givePerk("specialty_longersprint");
  71.     self maps\mp\perks\_perks::givePerk("specialty_lightweight");
  72.     self maps\mp\perks\_perks::givePerk("specialty_fastmantle");
  73.     self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
  74.     self maps\mp\perks\_perks::givePerk("specialty_holdbreath");
  75.     self maps\mp\perks\_perks::givePerk("specialty_improvedholdbreath");
  76.     self maps\mp\perks\_perks::givePerk("specialty_fastreload");
  77.     self maps\mp\perks\_perks::givePerk("specialty_fastsprintrecovery");
  78.     self maps\mp\perks\_perks::givePerk("specialty_automantle");
  79.     self maps\mp\perks\_perks::givePerk("specialty_bulletdamage");
  80.     self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration");
  81.     self maps\mp\perks\_perks::givePerk("specialty_rof");
  82.     self maps\mp\perks\_perks::givePerk("specialty_fastsnipe");
  83.  
  84.     self player_recoilScaleOn(0);
  85.  
  86.     // Instructions
  87.     //for(i = 0; i < 6; i++) {
  88.     //  self iPrintlnBold("^3Welcome ! Press ^21^3 to unsling your weapon and play!"); wait 0.50;
  89.     //}
  90.     self thread maps\mp\gametypes\_hud_message::hintMessage("^3Welcome to my mod !");
  91.     self thread maps\mp\gametypes\_hud_message::hintMessage("^3Mod created by Gillyns.");
  92.     self thread maps\mp\gametypes\_hud_message::hintMessage("^3Have Fun !");
  93.  
  94.     // Give everyone an Intervention + no recoil
  95.     self giveWeapon( "deserteagle_tactical_mp", 0, false );self GiveMaxAmmo("deserteagle_tactical_mp");
  96.     while(self getCurrentWeapon() != "deserteagle_tactical_mp") {
  97.         self switchToWeapon("deserteagle_tactical_mp");
  98.         wait 0.05;
  99.     }
  100. }
  101. init()
  102. {
  103.     level.scoreInfo = [];
  104.     level.xpScale = getDvarInt( "scr_xpscale" );
  105.     level.rankTable = [];
  106.     precacheShader("white");
  107.     precacheString( &"RANK_PLAYER_WAS_PROMOTEq_N" );
  108.     precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  109.     precacheString( &"RANK_PROMOTED" );
  110.     precacheString( &"MP_PLUS" );
  111.     precacheString( &"RANK_ROMANI" );
  112.     precacheString( &"RANK_ROMANII" );
  113.     precacheString( &"RANK_ROMANIII" );
  114.     if ( level.teamBased )
  115.     {
  116.         registerScoreInfo( "kill", 100 );
  117.         registerScoreInfo( "headshot", 100 );
  118.         registerScoreInfo( "assist", 20 );
  119.         registerScoreInfo( "suicide", 0 );
  120.         registerScoreInfo( "teamkill", 0 );
  121.     }
  122.     else
  123.     {
  124.         registerScoreInfo( "kill", 50 );
  125.         registerScoreInfo( "headshot", 50 );
  126.         registerScoreInfo( "assist", 0 );
  127.         registerScoreInfo( "suicide", 0 );
  128.         registerScoreInfo( "teamkill", 0 );
  129.     }
  130.     registerScoreInfo( "win", 1 );
  131.     registerScoreInfo( "loss", 0.5 );
  132.     registerScoreInfo( "tie", 0.75 );
  133.     registerScoreInfo( "capture", 300 );
  134.     registerScoreInfo( "defend", 300 );
  135.    
  136.     registerScoreInfo( "challenge", 2500 );
  137.  
  138.     level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  139.     level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  140.    
  141.     pId = 0;
  142.     rId = 0;
  143.     for ( pId = 0; pId <= level.maxPrestige; pId++ )
  144.     {
  145.         for ( rId = 0; rId <= level.maxRank; rId++ )
  146.             precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  147.     }
  148.  
  149.     rankId = 0;
  150.     rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  151.     assert( isDefined( rankName ) && rankName != "" );
  152.        
  153.     while ( isDefined( rankName ) && rankName != "" )
  154.     {
  155.         level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  156.         level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  157.         level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  158.         level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  159.  
  160.         precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  161.  
  162.         rankId++;
  163.         rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );    
  164.     }
  165.  
  166.     maps\mp\gametypes\_missions::buildChallegeInfo();
  167.  
  168.     level thread patientZeroWaiter();
  169.    
  170.     level thread onPlayerConnect();
  171. }
  172.  
  173. patientZeroWaiter()
  174. {
  175.     level endon( "game_ended" );
  176.    
  177.     while ( !isDefined( level.players ) || !level.players.size )
  178.         wait ( 0.05 );
  179.    
  180.     if ( !matchMakingGame() )
  181.     {
  182.         if ( (getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999) )
  183.             level.patientZeroName = level.players[0].name;
  184.     }
  185.     else
  186.     {
  187.         if ( getDvar( "scr_patientZero" ) != "" )
  188.             level.patientZeroName = getDvar( "scr_patientZero" );
  189.     }
  190. }
  191.  
  192. isRegisteredEvent( type )
  193. {
  194.     if ( isDefined( level.scoreInfo[type] ) )
  195.         return true;
  196.     else
  197.         return false;
  198. }
  199.  
  200.  
  201. registerScoreInfo( type, value )
  202. {
  203.     level.scoreInfo[type]["value"] = value;
  204. }
  205.  
  206.  
  207. getScoreInfoValue( type )
  208. {
  209.     overrideDvar = "scr_" + level.gameType + "_score_" + type; 
  210.     if ( getDvar( overrideDvar ) != "" )
  211.         return getDvarInt( overrideDvar );
  212.     else
  213.         return ( level.scoreInfo[type]["value"] );
  214. }
  215.  
  216.  
  217. getScoreInfoLabel( type )
  218. {
  219.     return ( level.scoreInfo[type]["label"] );
  220. }
  221.  
  222.  
  223. getRankInfoMinXP( rankId )
  224. {
  225.     return int(level.rankTable[rankId][2]);
  226. }
  227.  
  228.  
  229. getRankInfoXPAmt( rankId )
  230. {
  231.     return int(level.rankTable[rankId][3]);
  232. }
  233.  
  234.  
  235. getRankInfoMaxXp( rankId )
  236. {
  237.     return int(level.rankTable[rankId][7]);
  238. }
  239.  
  240.  
  241. getRankInfoFull( rankId )
  242. {
  243.     return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  244. }
  245.  
  246.  
  247. getRankInfoIcon( rankId, prestigeId )
  248. {
  249.     return tableLookup( "mp/rankIconTable.csv", 0, rankId, 11 );
  250. }
  251.  
  252. getRankInfoLevel( rankId )
  253. {
  254.     return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  255. }
  256.  
  257.  
  258. onPlayerConnect()
  259. {
  260.     for(;;)
  261.     {
  262.         level waittill( "connected", player );
  263.  
  264.         player thread killCrosshairs();
  265.  
  266.  
  267.         player.pers["rankxp"] = 2516000;
  268.        
  269.         rankId = player getRankForXp( player getRankXP() );
  270.         player.pers[ "rank" ] = rankId;
  271.         player.pers[ "participation" ] = 0;
  272.  
  273.         player.xpUpdateTotal = 0;
  274.         player.bonusUpdateTotal = 0;
  275.        
  276.         prestige = player getPrestigeLevel();
  277.         player setRank( rankId, prestige);
  278.         player syncXPStat();
  279.  
  280.         player.postGamePromotion = false;
  281.         if ( !isDefined( player.pers["postGameChallenges"] ) )
  282.         {
  283.             player setClientDvars(  "ui_challenge_1_ref", "",
  284.                                     "ui_challenge_2_ref", "",
  285.                                     "ui_challenge_3_ref", "",
  286.                                     "ui_challenge_4_ref", "",
  287.                                     "ui_challenge_5_ref", "",
  288.                                     "ui_challenge_6_ref", "",
  289.                                     "ui_challenge_7_ref", ""
  290.                                 );
  291.         }
  292.  
  293.         player setClientDvar(   "ui_promotion", 0 );
  294.        
  295.         if ( !isDefined( player.pers["summary"] ) )
  296.         {
  297.             player.pers["summary"] = [];
  298.             player.pers["summary"]["xp"] = 0;
  299.             player.pers["summary"]["score"] = 0;
  300.             player.pers["summary"]["challenge"] = 0;
  301.             player.pers["summary"]["match"] = 0;
  302.             player.pers["summary"]["misc"] = 0;
  303.  
  304.             // resetting game summary dvars
  305.             player setClientDvar( "player_summary_xp", "0" );
  306.             player setClientDvar( "player_summary_score", "0" );
  307.             player setClientDvar( "player_summary_challenge", "0" );
  308.             player setClientDvar( "player_summary_match", "0" );
  309.             player setClientDvar( "player_summary_misc", "0" );
  310.         }
  311.  
  312.  
  313.         // resetting summary vars
  314.        
  315.         player setClientDvar( "ui_opensummary", 0 );
  316.        
  317.         player maps\mp\gametypes\_missions::updateChallenges();
  318.         player.explosiveKills[0] = 0;
  319.         player.xpGains = [];
  320.        
  321.         player.hud_scorePopup = newClientHudElem( player );
  322.         player.hud_scorePopup.horzAlign = "center";
  323.         player.hud_scorePopup.vertAlign = "middle";
  324.         player.hud_scorePopup.alignX = "center";
  325.         player.hud_scorePopup.alignY = "middle";
  326.         player.hud_scorePopup.x = 0;
  327.         if ( level.splitScreen )
  328.             player.hud_scorePopup.y = -40;
  329.         else
  330.             player.hud_scorePopup.y = -60;
  331.         player.hud_scorePopup.font = "hudbig";
  332.         player.hud_scorePopup.fontscale = 0.75;
  333.         player.hud_scorePopup.archived = false;
  334.         player.hud_scorePopup.color = (0.5,0.5,0.5);
  335.         player.hud_scorePopup.sort = 10000;
  336.         player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
  337.        
  338.         player thread onPlayerSpawned();
  339.         player thread onJoinedTeam();
  340.         player thread onJoinedSpectators();
  341.     }
  342. }
  343.  
  344.  
  345. onJoinedTeam()
  346. {
  347.     self endon("disconnect");
  348.  
  349.     for(;;)
  350.     {
  351.         self waittill( "joined_team" );
  352.         self thread removeRankHUD();
  353.     }
  354. }
  355.  
  356.  
  357. onJoinedSpectators()
  358. {
  359.     self endon("disconnect");
  360.  
  361.     for(;;)
  362.     {
  363.         self waittill( "joined_spectators" );
  364.         self thread removeRankHUD();
  365.     }
  366. }
  367.  
  368.  
  369. onPlayerSpawned()
  370. {
  371.     self endon("disconnect");
  372.  
  373.     for(;;)
  374.     {
  375.         self waittill("spawned_player");
  376.         self thread doDvars();
  377.     }
  378. }
  379.  
  380.  
  381. roundUp( floatVal )
  382. {
  383.     if ( int( floatVal ) != floatVal )
  384.         return int( floatVal+1 );
  385.     else
  386.         return int( floatVal );
  387. }
  388.  
  389.  
  390. giveRankXP( type, value )
  391. {
  392.     self endon("disconnect");
  393.    
  394.     lootType = "none";
  395.    
  396.     if ( !self rankingEnabled() )
  397.         return;
  398.    
  399.     if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
  400.         return;
  401.     else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
  402.         return;
  403.  
  404.     if ( !isDefined( value ) )
  405.         value = getScoreInfoValue( type );
  406.  
  407.     if ( !isDefined( self.xpGains[type] ) )
  408.         self.xpGains[type] = 0;
  409.    
  410.     momentumBonus = 0;
  411.     gotRestXP = false;
  412.    
  413.     switch( type )
  414.     {
  415.         case "kill":
  416.         case "headshot":
  417.         case "shield_damage":
  418.             value *= self.xpScaler;
  419.         case "assist":
  420.         case "suicide":
  421.         case "teamkill":
  422.         case "capture":
  423.         case "defend":
  424.         case "return":
  425.         case "pickup":
  426.         case "assault":
  427.         case "plant":
  428.         case "destroy":
  429.         case "save":
  430.         case "defuse":
  431.             if ( getGametypeNumLives() > 0 )
  432.             {
  433.                 multiplier = max(1,int( 10/getGametypeNumLives() ));
  434.                 value = int(value * multiplier);
  435.             }
  436.  
  437.             value = int( value * level.xpScale );
  438.            
  439.             restXPAwarded = getRestXPAward( value );
  440.             value += restXPAwarded;
  441.             if ( restXPAwarded > 0 )
  442.             {
  443.                 if ( isLastRestXPAward( value ) )
  444.                     thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
  445.  
  446.                 gotRestXP = true;
  447.             }
  448.             break;
  449.     }
  450.    
  451.     if ( !gotRestXP )
  452.     {
  453.         if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
  454.             self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
  455.     }
  456.    
  457.     oldxp = self getRankXP();
  458.     self.xpGains[type] += value;
  459.    
  460.     self incRankXP( value );
  461.  
  462.     if ( self rankingEnabled() && updateRank( oldxp ) )
  463.         self thread updateRankAnnounceHUD();
  464.  
  465.     // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
  466.     self syncXPStat();
  467.  
  468.     if ( !level.hardcoreMode )
  469.     {
  470.         if ( type == "teamkill" )
  471.         {
  472.             self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
  473.         }
  474.         else
  475.         {
  476.             color = (1,1,0.5);
  477.             if ( gotRestXP )
  478.                 color = (1,.65,0);
  479.             self thread scorePopup( value, momentumBonus, color, 0 );
  480.         }
  481.     }
  482.  
  483.     switch( type )
  484.     {
  485.         case "kill":
  486.         case "headshot":
  487.         case "suicide":
  488.         case "teamkill":
  489.         case "assist":
  490.         case "capture":
  491.         case "defend":
  492.         case "return":
  493.         case "pickup":
  494.         case "assault":
  495.         case "plant":
  496.         case "defuse":
  497.             self.pers["summary"]["score"] += value;
  498.             self.pers["summary"]["xp"] += value;
  499.             break;
  500.  
  501.         case "win":
  502.         case "loss":
  503.         case "tie":
  504.             self.pers["summary"]["match"] += value;
  505.             self.pers["summary"]["xp"] += value;
  506.             break;
  507.  
  508.         case "challenge":
  509.             self.pers["summary"]["challenge"] += value;
  510.             self.pers["summary"]["xp"] += value;
  511.             break;
  512.            
  513.         default:
  514.             self.pers["summary"]["misc"] += value;  //keeps track of ungrouped match xp reward
  515.             self.pers["summary"]["match"] += value;
  516.             self.pers["summary"]["xp"] += value;
  517.             break;
  518.     }
  519. }
  520.  
  521. updateRank( oldxp )
  522. {
  523.     newRankId = self getRank();
  524.     if ( newRankId == self.pers["rank"] )
  525.         return false;
  526.  
  527.     oldRank = self.pers["rank"];
  528.     rankId = self.pers["rank"];
  529.     self.pers["rank"] = newRankId;
  530.  
  531.     //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );     
  532.     println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
  533.    
  534.     self setRank( newRankId );
  535.    
  536.     return true;
  537. }
  538.  
  539.  
  540. updateRankAnnounceHUD()
  541. {
  542.     self endon("disconnect");
  543.  
  544.     self notify("update_rank");
  545.     self endon("update_rank");
  546.  
  547.     team = self.pers["team"];
  548.     if ( !isdefined( team ) )
  549.         return;
  550.  
  551.     // give challenges and other XP a chance to process
  552.     // also ensure that post game promotions happen asap
  553.     if ( !levelFlag( "game_over" ) )
  554.         level waittill_notify_or_timeout( "game_over", 0.25 );
  555.    
  556.    
  557.     newRankName = self getRankInfoFull( self.pers["rank"] );   
  558.     rank_char = level.rankTable[self.pers["rank"]][1];
  559.     subRank = int(rank_char[rank_char.size-1]);
  560.    
  561.     thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
  562.  
  563.     if ( subRank > 1 )
  564.         return;
  565.    
  566.     for ( i = 0; i < level.players.size; i++ )
  567.     {
  568.         player = level.players[i];
  569.         playerteam = player.pers["team"];
  570.         if ( isdefined( playerteam ) && player != self )
  571.         {
  572.             if ( playerteam == team )
  573.                 player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
  574.         }
  575.     }
  576. }
  577.  
  578.  
  579. endGameUpdate()
  580. {
  581.     player = self;         
  582. }
  583.  
  584.  
  585. scorePopup( amount, bonus, hudColor, glowAlpha )
  586. {
  587.     self endon( "disconnect" );
  588.     self endon( "joined_team" );
  589.     self endon( "joined_spectators" );
  590.  
  591.     if ( amount == 0 )
  592.         return;
  593.  
  594.     self notify( "scorePopup" );
  595.     self endon( "scorePopup" );
  596.  
  597.     self.xpUpdateTotal += amount;
  598.     self.bonusUpdateTotal += bonus;
  599.  
  600.     wait ( 0.05 );
  601.  
  602.     if ( self.xpUpdateTotal < 0 )
  603.         self.hud_scorePopup.label = &"";
  604.     else
  605.         self.hud_scorePopup.label = &"MP_PLUS";
  606.  
  607.     self.hud_scorePopup.color = hudColor;
  608.     self.hud_scorePopup.glowColor = hudColor;
  609.     self.hud_scorePopup.glowAlpha = glowAlpha;
  610.  
  611.     self.hud_scorePopup setValue(self.xpUpdateTotal);
  612.     self.hud_scorePopup.alpha = 0.85;
  613.     self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
  614.  
  615.     increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
  616.        
  617.     if ( self.bonusUpdateTotal )
  618.     {
  619.         while ( self.bonusUpdateTotal > 0 )
  620.         {
  621.             self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
  622.             self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
  623.            
  624.             self.hud_scorePopup setValue( self.xpUpdateTotal );
  625.            
  626.             wait ( 0.05 );
  627.         }
  628.     }  
  629.     else
  630.     {
  631.         wait ( 1.0 );
  632.     }
  633.  
  634.     self.hud_scorePopup fadeOverTime( 0.75 );
  635.     self.hud_scorePopup.alpha = 0;
  636.    
  637.     self.xpUpdateTotal = 0;    
  638. }
  639.  
  640. removeRankHUD()
  641. {
  642.     self.hud_scorePopup.alpha = 0;
  643. }
  644.  
  645. getRank()
  646. {  
  647.     rankXp = self.pers["rankxp"];
  648.     rankId = self.pers["rank"];
  649.    
  650.     if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  651.         return rankId;
  652.     else
  653.         return self getRankForXp( rankXp );
  654. }
  655.  
  656.  
  657. levelForExperience( experience )
  658. {
  659.     return getRankForXP( experience );
  660. }
  661.  
  662.  
  663. getRankForXp( xpVal )
  664. {
  665.     rankId = 0;
  666.     rankName = level.rankTable[rankId][1];
  667.     assert( isDefined( rankName ) );
  668.    
  669.     while ( isDefined( rankName ) && rankName != "" )
  670.     {
  671.         if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  672.             return rankId;
  673.  
  674.         rankId++;
  675.         if ( isDefined( level.rankTable[rankId] ) )
  676.             rankName = level.rankTable[rankId][1];
  677.         else
  678.             rankName = undefined;
  679.     }
  680.    
  681.     rankId--;
  682.     return rankId;
  683. }
  684.  
  685.  
  686. getSPM()
  687. {
  688.     rankLevel = self getRank() + 1;
  689.     return (3 + (rankLevel * 0.5))*10;
  690. }
  691.  
  692. getPrestigeLevel()
  693. {
  694.     return self maps\mp\gametypes\_persistence::statGet( "prestige" );
  695. }
  696.  
  697. getRankXP()
  698. {
  699.     return self.pers["rankxp"];
  700. }
  701.  
  702. incRankXP( amount )
  703. {
  704.     if ( !self rankingEnabled() )
  705.         return;
  706.    
  707.     xp = self getRankXP();
  708.     newXp = (int( min( xp, getRankInfoMaxXP( level.maxRank ) ) ) + amount);
  709.    
  710.     if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  711.         newXp = getRankInfoMaxXP( level.maxRank );
  712.    
  713.     self.pers["rankxp"] = newXp;
  714. }
  715.  
  716. getRestXPAward( baseXP )
  717. {
  718.     if ( !getdvarint( "scr_restxp_enable" ) )
  719.         return 0;
  720.    
  721.     restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  722.    
  723.     wantGiveRestXP = int(baseXP * restXPAwardRate);
  724.     mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  725.    
  726.     if ( mayGiveRestXP <= 0 )
  727.         return 0;
  728.    
  729.     // we don't care about giving more rest XP than we have; we just want it to always be X2
  730.     //if ( wantGiveRestXP > mayGiveRestXP )
  731.     //  return mayGiveRestXP;
  732.    
  733.     return wantGiveRestXP;
  734. }
  735.  
  736.  
  737. isLastRestXPAward( baseXP )
  738. {
  739.     if ( !getdvarint( "scr_restxp_enable" ) )
  740.         return false;
  741.    
  742.     restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  743.    
  744.     wantGiveRestXP = int(baseXP * restXPAwardRate);
  745.     mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  746.  
  747.     if ( mayGiveRestXP <= 0 )
  748.         return false;
  749.    
  750.     if ( wantGiveRestXP >= mayGiveRestXP )
  751.         return true;
  752.        
  753.     return false;
  754. }
  755.  
  756. syncXPStat()
  757. {
  758.     xp = 2516000; //self getRankXP();
  759.    
  760.     self maps\mp\gametypes\_persistence::statSet( "experience", xp );
  761. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement