Advertisement
Guest User

Untitled

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