Advertisement
Guest User

Untitled

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