Advertisement
Guest User

Untitled

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