Advertisement
Guest User

Untitled

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