Advertisement
Guest User

Untitled

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