Advertisement
Guest User

Untitled

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