Advertisement
Guest User

sv cheats on in mw2

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