Advertisement
JoBoz

For you...

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