Advertisement
Guest User

Untitled

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