Advertisement
Guest User

Untitled

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