Advertisement
brucelee

mw2 get coordinates and angles for making maps

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