Advertisement
Guest User

Untitled

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