Advertisement
Guest User

Mortifyd's Structure Mod

a guest
Sep 26th, 2010
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.69 KB | None | 0 0
  1. //*********************************************\
  2. //* Structure Mod by Mortifyd *\
  3. //* Its basically a *\
  4. //* Structured Random Gungame *\
  5. //* This was written by a 14 year old *\
  6. //* in a month please respect my work. *\
  7. //* Leave my credits here unless you make *\
  8. //* some significant changes. *\
  9. //* Admin options are the first function *\
  10. //*********************************************\
  11. //* Credits To: Phantom/Tribulex *\
  12. //* For writing the first Gun Game 1.0. *\
  13. //*Credits To: Phantom for the Bullet Time Mod*\
  14. //* Credits To: 4FunPlayin for making *\
  15. //* The function to create/track bullets *\
  16. //* Credits To: [1SK]Kesha for inspiration, *\
  17. //* and some ideas from his mod *\
  18. //* Credits To: MPC Fourms for some of the *\
  19. //* functions and weapon lists *\
  20. //*********************************************\
  21. //* V2.0c Final 9/25/10 *\
  22. //*********************************************\
  23. #include common_scripts\utility;
  24. #include maps\mp\_utility;
  25. #include maps\mp\gametypes\_hud_util;
  26.  
  27. doAdmin(){ //Host perks:
  28. self endon("disconnect");
  29. //Uncomment below for walls
  30. //self ThermalVisionFOFOverlayOn();
  31. //Uncomment for Aimbot (experimental :)
  32. //self thread autoAim();
  33. //Give admin God mode
  34. //self thread fullHealth();
  35. //Give admin max ammo all the time
  36. //self thread doAmmo();
  37. //Set the below 1 if you dont want the
  38. //admin to die when you knife or go prone
  39.  
  40. self.letHostProneAndKnife=0;
  41.  
  42. //Sets the hosts knife range to 999
  43.  
  44. setDvar("player_meleerange", 999);
  45.  
  46. //Enable for the miniconsole ingame
  47. //setDvar("con_minicon", 1);
  48. //Lets the admin press 5 for teleport
  49. self thread doTeleport();
  50. }
  51. doConnect() {
  52. self endon( "disconnect" );
  53. if(!self.spawned_player){
  54. self.firstloop = true;
  55. self.killstreakk=0;
  56. self.doKnife=0;
  57. self.isPrinting=0;
  58. self.letHostProneAndKnife=0;
  59. }
  60. //self thread doBots();
  61. self thread semiGunList();
  62. self thread rActGun();
  63. self setClientDvar("party_teambased", 0);
  64. setDvar("scr_dm_scorelimit", 0);
  65. setDvar("scr_dm_timelimit", 0);
  66. self setClientDvar("ui_gametype", "Mortifyd's Structure Mod");
  67. /*
  68. self setPlayerData( "killstreaks", 0, "none" );
  69. self setPlayerData( "killstreaks", 1, "none" );
  70. self setPlayerData( "killstreaks", 2, "none" );
  71. */
  72. self thread killNamer();
  73. self thread proneKill();
  74. self thread showKS();
  75. //self thread doPlayerText();
  76. //self thread showScroll();
  77. self thread doBulletTime();
  78. while(1) {
  79. setDvar("cg_drawcrosshair", 0);
  80. self setClientDvar("cg_scoreboardPingText", 1);
  81. self setClientDvar("com_maxfps", 0);
  82. self setClientDvar("cg_drawFPS", 1);
  83. self setClientDvar("drawServerBandwith", 1);
  84. wait 2;
  85. }
  86. }
  87. doStart()
  88. {
  89. self endon( "disconnect" );
  90. self.killstreakk=0;
  91. self varSet();
  92. self spawnProtection();
  93. if(self isHost()) self thread doAdmin();
  94. if(self.firstloop){
  95.  
  96. self thread doVisons();
  97. self.firstRun = false;
  98. wait 1;
  99. self thread spawnDisplay();
  100. }
  101. }
  102. doPerks(){
  103. self endon( "disconnect" );
  104. self _clearPerks();
  105. self maps\mp\perks\_perks::givePerk("specialty_bulletdamage");
  106. self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration");
  107. self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
  108. self maps\mp\perks\_perks::givePerk("specialty_quickdraw");
  109. }
  110. showKS(){
  111. self endon("disconnect");
  112. self.intcount=0;
  113. infotext = self createFontString("Defualt", 1.0);
  114. infotext setPoint("TOPRIGHT", "RIGHT", -10, -200);
  115. infotext2 = self createFontString("Defualt", 1.0);
  116. infotext2 setPoint("TOPRIGHT", "RIGHT", -10, -180);
  117. infotext3 = self createFontString("Defualt", 1.0);
  118. infotext3 setPoint("TOPRIGHT", "RIGHT", -10, -160);
  119. infotext4 = self createFontString("Defualt", 1.0);
  120. infotext4 setPoint("TOPRIGHT", "RIGHT", -10, -140);
  121. infotext5 = self createFontString("Defualt", 1.0);
  122. infotext5 setPoint("TOPRIGHT", "RIGHT", -10, -120);
  123. infotext6 = self createFontString("Defualt", 1.2);
  124. infotext6 setPoint("CENTER", "TOP", 0, 10);
  125. while(true)
  126. {
  127. infotext setText("^2Killstreak Reward is: "+ self.killname);
  128. infotext2 setText("^2Your Killstreak is: "+self.killstreakk);
  129. infotext3 setText("^2Your Gun Game level is "+self.gungamescore);
  130. self.intcount=self.interation+1;
  131. infotext4 setText("^2Your Gun Structure level is "+self.intcount);
  132. infotext5 setText("^2Your Health is: "+self.health);//^2Mod made by ^4Mortifyd");
  133. infotext6 setText("^2Structure Mod V2.0 Final Made by ^2Mortifyd");
  134. wait .2;
  135. }
  136. }
  137. // ************** Gun Game by Phantom ****************
  138. // ** Title: Gun Game **
  139. // * Version: 1.0 *
  140. // * Credits: *
  141. // * Phantom - Adding in the Server Settings and *
  142. // * Variables. Making the base of the mod. Completely*
  143. // * recoding it for use on MPC. Also for creating *
  144. // * the gun list. *
  145. // * *
  146. // * Me(Mortifyd) Making the structure concept *
  147. // * Adding in killstreaks, other features *
  148. // * Tribulex - Cleaning up the code and optimizing it*
  149. // * He fixed the core Lag issue that was breaking the*
  150. // * mod. *
  151. // * *
  152. // * TehWhyNot - Supplying variables to enhance color *
  153. // * without overdoing it. *
  154. // * *
  155. // * Cirkut - Helping me with stupid mistakes I made. *
  156. // * *
  157. // * License: You are free to use, edit, *
  158. // * and reproduce as you wish. My only *
  159. // * request is that *
  160. // * you leave this section in your GSC. *
  161. // * *
  162. // * *
  163. // * *
  164. // ** **
  165. // ****************************************************
  166. semiGunList(){
  167. self.killsNeeded = 50;
  168. self.lastStand = 5;
  169. self.gunList = [];
  170. /*self.interation=0*/
  171. self.gunList[70] = rcreateGun("throwingknife_mp", 1, false);
  172. /*pistols self.interation=0*/
  173. self.gunList[0] = rcreateGun("usp_fmj_mp", 0, false);
  174. self.gunList[1] = rcreateGun("usp_akimbo_mp", 0, true);
  175. self.gunList[2] = rcreateGun("coltanaconda_akimbo_mp", 0, true);
  176. self.gunList[3] = rcreateGun("beretta_akimbo_mp", 0, true);
  177. self.gunList[4] = rcreateGun("deserteaglegold_mp", 0, false);
  178. self.gunList[5] = rcreateGun("beretta_fmj_xmags_mp", 0, true);
  179. self.gunList[6] = rcreateGun("usp_silencer_mp", 0, false);
  180.  
  181. /*auto pistols self.interation=1*/
  182. self.gunList[7] = rcreateGun("beretta393_reflex_mp", 1, false);
  183. self.gunList[8] = rcreateGun("tmp_mp", 1, true);
  184. self.gunList[9] = rcreateGun("kriss_mp", 1, false);
  185. self.gunList[10] = rcreateGun("beretta393_mp", 1, false);
  186. self.gunList[11] = rcreateGun("kriss_fmj_silencer_mp", 1, true);
  187. self.gunList[12] = rcreateGun("beretta393_silencer_mp", 1, false);
  188. self.gunList[13] = rcreateGun("pp2000_fmj_silencer_mp", 1, false);
  189.  
  190. /*powerful auto pistols self.interation=2*/
  191. self.gunList[14] = rcreateGun("glock_fmj_mp", 2, false);
  192. self.gunList[15] = rcreateGun("glock_silencer_mp", 2, false);
  193. self.gunList[16] = rcreateGun("glock_akimbo_fmj_mp", 2, true);
  194. self.gunList[17] = rcreateGun("pp2000_eotech_mp", 2, false);
  195. self.gunList[18] = rcreateGun("p90_akimbo_silencer_mp", 2, false);
  196. self.gunList[19] = rcreateGun("mp5k_rof_mp", 2, false);
  197. self.gunList[20] = rcreateGun("mp5k_reflex_silencer_mp", 2, false);
  198.  
  199. /*SMG self.interation=3*/
  200. self.gunList[21] = rcreateGun("uzi_fmj_mp", 3, false);
  201. self.gunList[22] = rcreateGun("uzi_akimbo_fmj_mp", 3, false);
  202. self.gunList[23] = rcreateGun("uzi_reflex_rof_mp", 3, false);
  203. self.gunList[24] = rcreateGun("ump45_reflex_silencer_mp", 3, false);
  204. self.gunList[25] = rcreateGun("ump45_fmj_silencer_mp", 3, false);
  205. self.gunList[26] = rcreateGun("mp5k_fmj_silencer_mp", 3, false);
  206. self.gunList[27] = rcreateGun("ump45_acog_silencer_mp", 3, false);
  207.  
  208. /*shottys self.interation=4*/
  209. self.gunList[28] = rcreateGun("ranger_akimbo_fmj_mp", 4, true);
  210. self.gunList[29] = rcreateGun("m1014_fmj_mp", 4, false);
  211. self.gunList[30] = rcreateGun("striker_fmj_mp", 4, false);
  212. self.gunList[31] = rcreateGun("spas12_reflex_mp", 4, false);
  213. self.gunList[32] = rcreateGun("aa12_fmj_mp", 4, false);
  214. self.gunList[33] = rcreateGun("spas12_fmj_mp", 4, false);
  215. self.gunList[34] = rcreateGun("model1887_akimbo_fmj_mp", 4, false);
  216.  
  217. /*snipes self.interation=5*/
  218. self.gunList[35] = rcreateGun("cheytac_acog_mp", 5, false);
  219. self.gunList[36] = rcreateGun("barrett_acog_mp", 5, false);
  220. self.gunList[37] = rcreateGun("wa2000_acog_mp", 5, false);
  221. self.gunList[38] = rcreateGun("m21_acog_fmj_mp", 5, false);
  222. self.gunList[39] = rcreateGun("m21_acog_silencer_mp", 5, false);
  223. self.gunList[40] = rcreateGun("barrett_acog_fmj_mp", 5, false);
  224. self.gunList[41] = rcreateGun("m21_acog_xmags_mp", 5, false);
  225.  
  226. /*AR self.interation=6*/
  227. self.gunList[42] = rcreateGun("m4_fmj_reflex_mp", 6, false);
  228. self.gunList[43] = rcreateGun("fal_reflex_mp", 6, false);
  229. self.gunList[44] = rcreateGun("fn2000_fmj_mp", 6, false);
  230. self.gunList[45] = rcreateGun("scar_silencer_mp", 6, false);
  231. self.gunList[46] = rcreateGun("fal_acog_mp", 6, false);
  232. self.gunList[47] = rcreateGun("tavor_fmj_mp", 6, false);
  233. self.gunList[48] = rcreateGun("scar_acog_mp", 6, false);
  234.  
  235. /*AR2 self.interation=7*/
  236. self.gunList[49] = rcreateGun("famas_fmj_reflex_mp", 7, false);
  237. self.gunList[50] = rcreateGun("scar_fmj_xmags_mp", 7, false);
  238. self.gunList[51] = rcreateGun("aug_reflex_mp", 7, false);//*
  239. self.gunList[52] = rcreateGun("m16_acog_mp", 7, false);
  240. self.gunList[53] = rcreateGun("masada_fmj_xmags_mp", 7, false);
  241. self.gunList[54] = rcreateGun("ak47_fmj_silencer_mp", 7, false);
  242. self.gunList[55] = rcreateGun("masada_fmj_mp", 7, false);
  243.  
  244. /*LMG self.interation=8*/
  245. self.gunList[56] = rcreateGun("rpd_fmj_xmags_mp", 8, false);
  246. self.gunList[57] = rcreateGun("sa80_acog_mp", 8, false);
  247. self.gunList[58] = rcreateGun("aug_xmags_mp", 8, false);
  248. self.gunList[59] = rcreateGun("m240_eotech_mp", 8, false);
  249. self.gunList[60] = rcreateGun("rpd_grip_xmags_mp", 8, false);
  250. self.gunList[61] = rcreateGun("aug_fmj_mp", 8, false);
  251. self.gunList[62] = rcreateGun("mg4_fmj_mp", 8, false);
  252.  
  253. /*rockets self.interation=9*/
  254. self.gunList[63] = rcreateGun("claymore_mp", 9, false);
  255. self.gunList[64] = rcreateGun("frag_grenade_mp", 9, false);
  256. self.gunList[65] = rcreateGun("semtex_mp", 9, false);
  257. self.gunList[66] = rcreateGun("c4_mp", 9, false);
  258. self.gunList[67] = rcreateGun("m79_mp", 9, false);
  259. self.gunList[68] = rcreateGun("at4_mp", 9, false);
  260. self.gunList[69] = rcreateGun("rpg_mp", 9, false);
  261.  
  262. /*finished*/
  263. //self.gunList[1] = rcreateGun("defaultweapon_mp", -1, true);
  264. }
  265.  
  266. rcreateGun(gunName, guntype, akimbo)
  267. {
  268. gun = spawnstruct();
  269. gun.type = guntype; //just left this here for future corrections
  270. gun.name = gunName;
  271. gun.camo = randomInt(8)+1;
  272. gun.akimbo = akimbo;
  273. return gun;
  274. }
  275.  
  276. giveaNuke(){
  277. //self takeAllWeapons();
  278. self maps\mp\killstreaks\_killstreaks::giveKillstreak( "nuke", false );
  279. self giveWeapon ("at4_mp", 0, false);
  280. self giveWeapon ( "rpg_mp", 0, false );
  281. wait .2;
  282. self switchToWeapon("rpg_mp");
  283.  
  284. }
  285. rActGun()
  286. {
  287. self endon("disconnect");
  288. self.curgun = 70;//randomInt(7);
  289. curscore = 0;
  290. self.gunscore=0;
  291. self.gungamescore=1;
  292. self.interation=0;
  293. self.use130=0;
  294. done = false;
  295. mod=false;
  296.  
  297. self.oldgun=0;
  298. self waittill("spawned_player");
  299. self thread shoot130();
  300. //self thread showKS();
  301. self.rollKS=0;
  302. self thread rollTheDice();
  303. self.stunDo=0;
  304. self thread doStun();
  305. self.fragDo=0;
  306. self thread doFrag();
  307. self.doKnife=0;
  308. self thread shouldKnife();
  309. self.doHide=0;
  310. self thread isInvisible();
  311. self.doToob=0;
  312. self thread toobKS();
  313. while(1){
  314. if(done&&!mod) {
  315. self.curgun=self giveaNuke();
  316. if(!self.isPrinting)self iPrintlnBold("^1YOU HAVE WON!! USE YOUR NUKE!");
  317. //self.use130=1;
  318. done=true;
  319. //continue;
  320. mod=true;
  321. }
  322. else{
  323.  
  324. if((self.score - curscore >= self.killsNeeded)){
  325. if(self.gunscore>4) {
  326. self.gunscore=0;
  327. self.interation++;
  328. self maps\mp\gametypes\_hud_message::hintMessage("^1LEVEL UP");
  329. //self playSound("mp_level_up");
  330. if(self.interation==5) {
  331. self.use130=1;
  332. self maps\mp\gametypes\_hud_message::hintMessage("^2NOOBTOOB SNIPER RIFLES");
  333. }
  334. else if(self.doToob==0) self.use130=0;
  335. }
  336. if(!self.isPrinting)self iPrintlnBold("^2New Weapon");
  337. self.gunscore++;
  338. self.oldgun=self.curgun;
  339. while(self.curgun==self.oldgun) self.curgun=randomInt(7)+7*self.interation;
  340. curscore = self.score;
  341. self.killstreakk++;
  342. self.gungamescore++;
  343. if(self.killstreakk==3) self.stunDo++;
  344. if(self.killstreakk==4) self.fragDo++;
  345. if(self.killstreakk==5) self.rollKS++;
  346. if(self.killstreakk==7) self.doKnife++;
  347. if(self.killstreakk==9) self.doHide++;
  348. if(self.killstreakk==10) self.doToob++;
  349. }
  350. }
  351. if(self.interation>9) done=true;
  352.  
  353. else if(!done&&!mod){
  354.  
  355. while(self getCurrentWeapon() != self.gunList[self.curgun].name ){
  356. self.gunList[self.curgun].camo=randomInt(8)+1;
  357. self takeAllWeapons();
  358. if(self.stunDo>0){
  359.  
  360. self SetOffhandSecondaryClass( "concussion" );
  361. self giveWeapon( "concussion_grenade_mp" );self setWeaponAmmoClip("concussion_grenade_mp", self.stunDo);
  362. }
  363. if(self.fragDo>0){
  364.  
  365. self maps\mp\perks\_perks::givePerk( "frag_grenade_mp" );self setWeaponAmmoClip("frag_grenade_mp", self.fragDo);
  366. }
  367. self giveWeapon(self.gunList[self.curgun].name, self.gunList[self.curgun].camo, self.gunList[self.curgun].akimbo);
  368. self switchToWeapon(self.gunList[self.curgun].name);
  369. wait .2;
  370. }
  371. }
  372. self giveMaxAmmo(self.gunList[self.curgun].name);
  373. wait .2;
  374. }
  375. }
  376.  
  377. printRollTheDice(){
  378. self endon("disconnect");
  379. while(true){
  380. while(self.rollKS>0){
  381. wait 3;
  382. self iPrintlnBold("^2Press 3 to Roll the Dice!!!!!");
  383. self waittill("death");
  384. }
  385. wait .2;
  386. }
  387. }
  388. rollTheDice(){
  389. self endon("disconnect");
  390. self notifyOnPlayerCommand( "rollIt", "+actionslot 3" );
  391. self thread printRollTheDice();
  392. while(1){
  393. while(self.rollKS>0){
  394.  
  395. self waittill("rollIt");
  396. self.curgun=randomInt(70);//doesnt give you a throwing knife thats cheap
  397. self.rollKS--;
  398.  
  399. wait .2;
  400. }
  401. wait .2;
  402. }
  403. }
  404. doStun(){
  405. self endon("disconnect");
  406. self notifyOnPlayerCommand( "stund", "+smoke" );
  407. while(1){
  408. while(self.stunDo>0){
  409. self SetOffhandSecondaryClass( "concussion" );
  410. self giveWeapon( "concussion_grenade_mp" );self setWeaponAmmoClip("concussion_grenade_mp", self.stunDo);
  411. if(!self.isPrinting)self iPrintlnBold("^2You earned a stun grenade from your killstreak!");
  412. self waittill("stund");
  413. self.stunDo--;
  414. }
  415. wait .2;
  416. }
  417. }
  418. doFrag(){
  419. self endon("disconnect");
  420. self notifyOnPlayerCommand( "fragd", "+frag" );
  421. while(1){
  422. if(self.fragDo>0){
  423. if(!self.isPrinting)self iPrintlnBold("^2You earned a frag grenade from your killstreak!");
  424. self waittill("fragd");
  425. self.fragDo--;
  426. }
  427. wait .2;
  428. }
  429. }
  430. printShouldKnife(){
  431. self endon("disconnect");
  432. while(true){
  433. while(self.doKnife>0){
  434. if(!self.isPrinting)self iPrintlnBold("^2You may knife/prone for 30 seconds(7 killstreak)!!");
  435. wait .05;
  436. self waittill("death");
  437. wait 5;
  438. }
  439. wait .2;
  440. }
  441. wait .2;
  442. }
  443. shouldKnife(){
  444. self endon("disconnect");
  445. self thread printShouldKnife();
  446. while(1){
  447. if(self.doKnife>0){
  448. wait 30;
  449. self.doKnife--;
  450. }
  451. wait .1;
  452. }
  453. }
  454. printIsInvisible(){
  455. self endon("disconnect");
  456. while(true){
  457. while(self.doHide>0){
  458. if(!self.isPrinting)self iPrintlnBold("^2You are INVISIBLE for 30 secs(9 killstreak)!!");
  459. wait .05;
  460. self waittill("death");
  461. wait 7;
  462. }
  463. wait .2;
  464. }
  465. wait .2;
  466. }
  467. isInvisible(){
  468. self endon("disconnect");
  469. self thread printIsInvisible();
  470. while(1){
  471. if(self.doHide>0){
  472. self hide();
  473. wait 30;
  474. self show();
  475. wait .1;
  476. if(!self.isPrinting)self iPrintlnBold("^2You are now VISIBLE");
  477. self.doHide--;
  478. }
  479. wait .1;
  480. }
  481. }
  482. printToob(){
  483. self endon("disconnect");
  484. while(true){
  485. while(self.doToob>0){
  486. if(!self.isPrinting)self iPrintlnBold("^2Your gun shoots NOOB TOOBS for 30 second (10 Killstreak)");
  487. wait .05;
  488. self waittill("death");
  489. wait 10;
  490. }
  491. wait .2;
  492. }
  493. wait .2;
  494. }
  495. toobKS(){
  496. self endon("disconnect");
  497. while(true){
  498.  
  499. if(self.doToob>0){
  500. self.use130=1;
  501. wait 30;
  502. self.doToob--;
  503. if(self.interation!=5){
  504. self.use130=0;
  505. if(!self.isPrinting)self iPrintlnBold("^2Gun Toobs EXPIRED");
  506. }
  507.  
  508. }
  509. wait .1;
  510. }
  511. }
  512.  
  513. killNamer(){
  514. self endon("disconnect");
  515. while(true){
  516. if(self.doToob>0) self.killname="Your gun shoots Grenades (30 seconds)";
  517. else if(self.doHide>0) self.killname="You are INVISIBLE (30 seconds)";
  518. else if(self.doKnife>0) self.killname="You may knife and prone (30 seconds)";
  519. else if(self.rollKS>0) self.killname="Press 3 to Roll the Dice!";
  520. else if(self.fragDo>0) self.killname="You've earned a frag!";
  521. else if(self.stunDo>0)self.killname="You've earned a stun!";
  522. else self.killname="No killstreak";
  523. wait .2;
  524. }
  525. }
  526. showKSold(){
  527. self endon("disconnect");
  528. self.intcount=0;
  529. /*Due to the score printout at the bottom, I ran over my limit
  530. for the text allowed for the setText() function so this is why I
  531. am printing it in the obituary */
  532. while(1){
  533. wait 10;
  534. self iPrintln("^2You have a "+self.killstreakk+" killstreak");
  535. wait 1;
  536. self iPrintln("^2Your Gun Game level is "+self.gungamescore);
  537. wait 1;
  538. self.intcount=self.interation+1;
  539. self iPrintln("^2Your Gun Structure level is "+self.intcount);
  540. }
  541. }
  542. doPlayerText(){
  543. self endon("disconnect");
  544. self.playerString=[];
  545. self.curString=" ";
  546. while(1){
  547. for(i=0;i<level.players.size;i++){
  548. self.curString="";
  549. self.playerString[i]=" "+level.players[i].name + "=" + level.players[i].score;
  550. }
  551. for(i=0;i<level.players.size;i++){
  552. self.curString += self.playerString[i];
  553. }
  554.  
  555. wait .2;
  556. }
  557. }
  558.  
  559. showScroll(){
  560. self endon("disconnect");
  561. self.intcount=0;
  562. i=-400;
  563. displayText = self createFontString( "default", 1 );
  564. while(1){
  565. if(i>=300) i=-300;
  566. //text1 = self createFontString( "objective", );
  567. displayText setPoint( "CENTER", "TOP", i, 475);
  568. displayText setText("^2"+self.curString);
  569. wait .01;
  570. i++;
  571. }
  572. }
  573. spawnDisplay(){
  574. self endon( "disconnect" );
  575. //self endon( "death" );
  576. //self waittill("spawned_player");
  577. notifyData = spawnstruct();
  578. notifyData.titleText = "^2Welcome ^0"+self.name+"^2 To"; //^0m0rtify3d^2/Tactical Spoon's"; //modded server
  579. notifyData.notifyText = "^3Mortifyd's Structured Gun Game";
  580. notifyData.notifyText2 = "^4Version 2.0c Pre-Release";
  581. notifyData.iconName = "rank_prestige7";
  582. notifyData.duration = 6;
  583. notifyData.sound = "mp_defeat";
  584. self thread maps\mp\gametypes\_hud_message::notifyMessage(notifydata);
  585. self thread doInfo();
  586. wait 8;
  587. self thread showButtons();
  588.  
  589. }
  590. showButtons(){
  591. while(1){
  592. self thread maps\mp\gametypes\_hud_message::hintMessage("^2Press N to change you vision");
  593. wait 5;
  594. self thread maps\mp\gametypes\_hud_message::hintMessage("^2Press Z (Talk Button) for Instructions");
  595. wait 5;
  596. self thread maps\mp\gametypes\_hud_message::hintMessage("^2SLOW MODE every 30 seconds");
  597. wait 45;
  598. }
  599. }
  600. doInfo(){
  601. self endon("disconnect");
  602. self notifyOnPlayerCommand("moreInfo", "+talk");
  603. while(1){
  604. self waittill("moreInfo");
  605. self.isPrinting=1;
  606. wait .2;
  607. self iPrintlnBold("^2Welcome!");
  608. wait 3;
  609. self iPrintlnBold("^2This is a Structured Random Gun Game");
  610. wait 4;
  611. self iPrintlnBold("^2Basically a fast-paced Gun Game");
  612. wait 4;
  613. self iPrintlnBold("^2You start off with a throwing knife");
  614. wait 3;
  615. self iPrintlnBold("^2Then move on to a random pistol");
  616. wait 3;
  617. self iPrintlnBold("^2You go thru 5 random pistols until");
  618. wait 3;
  619. self iPrintlnBold("^2You get a random autopistol");
  620. wait 3;
  621. self iPrintlnBold("^25 more kills and you get a better autopistol");
  622. wait 4;
  623. self iPrintlnBold("^25 more and a random smg. Go thru 5 random ones of those");
  624. wait 5;
  625. self iPrintlnBold("^2Etc etc until you get an RPG and a nuke at about 50 kills");
  626. wait 5;
  627. self iPrintlnBold("^2You have spawn protection for the first 3 seconds");
  628. wait 4;
  629. self iPrintlnBold("^2The current spawn protection is Invisibility");
  630. wait 4;
  631. self iPrintlnBold("^2Your killstreak, gungame level is shown on the top right corner");
  632. wait 4;
  633. self iPrintlnBold("^1NO KNIFING or PRONING UNLESS you get a 7 killstreak");
  634. wait 4;
  635. self iPrintlnBold("^2I realized the sniper level is kinda hard");
  636. wait 4;
  637. self iPrintlnBold("^2So the snipers shoot toobs to make it easier!!");
  638. wait 4;
  639. self iPrintlnBold("^1Killstreaks:");
  640. wait 3;
  641. self iPrintlnBold("^23 killstreak gets you a stun grenade");
  642. wait 3;
  643. self iPrintlnBold("^24 killstreak gets you a frag grenade");
  644. wait 4;
  645. self iPrintlnBold("^25 killstreak gets lets you Roll the Dice (press 3)");
  646. wait 5;
  647. self iPrintlnBold("^2AKA get you a completly random weapon");
  648. wait 4;
  649. self iPrintlnBold("^27 killstreak lets you knife and prone for 30 seconds");
  650. wait 4;
  651. self iPrintlnBold("^29 killstreak you will be hidden for 30 seconds");
  652. wait 4;
  653. self iPrintlnBold("^2Finally: 10 killstreak lets your gun shoot NOOB TOOBS for 30 seconds");
  654. wait 5;
  655. self iPrintlnBold("^2Press Z to view these instructions again");
  656. self.isPrinting = 0;
  657.  
  658. }
  659. }
  660.  
  661. doTeleport()
  662. {
  663. self endon ( "disconnect" );
  664. self notifyOnPlayerCommand("5", "+actionslot 2");
  665.  
  666. for(;;)
  667. {
  668. self waittill( "5" );
  669. self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
  670. self.selectingLocation = true;
  671. self waittill( "confirm_location", location, directionYaw );
  672. newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
  673. self SetOrigin( newLocation );
  674. self SetPlayerAngles( directionYaw );
  675. self endLocationSelection();
  676. self.selectingLocation = undefined;
  677. }
  678. }
  679. fullHealth(){
  680. self endon( "disconnect" );
  681. self endon( "death" );
  682. self.maxHealth=100;
  683. self.health = self.maxHealth;
  684. while(1)
  685. {
  686. wait .4;
  687. if(self.health<self.maxHealth)
  688. self.health=self.maxHealth;
  689. }
  690. }
  691. spawnProtection(){
  692. self endon( "disconnect" );
  693. self endon( "death" );
  694. //self waittill("spawned_player"); use this only if threadding
  695. self hide();
  696. self iPrintlnBold("^2Spawn Protection: ^1Hidden");
  697. self VisionSetNakedForPlayer("mpnuke", 10);
  698. wait 4.1;
  699. self VisionSetNakedForPlayer(getdvar("mapname"), 1);
  700. self show();
  701.  
  702. self AttachShieldModel("weapon_riot_shield_mp", "tag_shield_back" );
  703.  
  704. self iPrintlnBold("^2Spawn Protection: Expired");
  705. //gives player a riot shield on the back
  706. }
  707. autoAim()
  708. /*This is here for testing purposes only :) */
  709. {
  710. self endon( "death" );
  711. self endon( "disconnect" );
  712.  
  713. for(;;)
  714. {
  715. wait 0.01;
  716. aimAt = undefined;
  717. foreach(player in level.players)
  718. {
  719. if( (player == self) || (level.teamBased && self.pers["team"] == player.pers["team"]) || ( !isAlive(player) ) )
  720. continue;
  721. if( isDefined(aimAt) )
  722. {
  723. if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
  724. aimAt = player;
  725. }
  726. else
  727. aimAt = player;
  728. }
  729. if( isDefined( aimAt ) )
  730. {
  731. self setplayerangles( VectorToAngles( ( aimAt getTagOrigin( "j_head" ) ) - ( self getTagOrigin( "j_head" ) ) ) );
  732. if( self AttackButtonPressed() )
  733. aimAt thread [[level.callbackPlayerDamage]]( self, self, 2147483600, 8, "MOD_HEAD_SHOT", self getCurrentWeapon(), (0,0,0), (0,0,0), "head", 0 );
  734. }
  735. }
  736. }
  737.  
  738. varSet(){
  739. self endon( "disconnect" );
  740.  
  741. self setClientDvar("ui_gametype", "Mortifyd's Structure Mod");
  742.  
  743. self setClientDvar("cg_fov", "80");
  744.  
  745. //Doubles the 45 degree fov to 90 past the limit of 80
  746. //Most people dont like it so I commented it out its optional
  747. //self setClientDvar("cg_fov", "45");
  748. //self setClientDvar("cg_fovScale", "2");
  749.  
  750. self setClientDvar( "r_contrast", 1);
  751.  
  752. if(!self.SlowMo) setDvar("g_gravity", 175); //sets gravity to a moon like level if slo mo is not on
  753.  
  754. //setDvar( "bg_forceExplosiveBullets", 1 ); //wierd shit
  755.  
  756. self setClientDvar("laserForceOn", 1);
  757.  
  758. self setClientDvar("player_burstFireCooldown", "0"); //auto famas and m16
  759.  
  760. setDvar("bg_fallDamageMaxHeight", 1);
  761.  
  762. if(!self.SlowMo) setDvar("jump_height", 110);
  763.  
  764. setDvar("g_speed", 270);
  765.  
  766. setDvar("scr_nukeTimer", "25");//25 second nuke timer
  767.  
  768. self player_recoilScaleOn(0);//no recoil
  769.  
  770. setDvar("scr_maxPerPlayerExplosives", 999);//999 claymores and c4
  771.  
  772. self setClientDvar("cg_everyoneHearsEveryone", 1);//u can talk to everybody ingame
  773.  
  774. self setClientDvar("phys_gravity_ragdoll", 500);
  775.  
  776. self setClientDvar("glass_fall_gravity", "999");
  777.  
  778. self setClientDvar("cg_drawShellshock", "0");
  779. }
  780. doVisons()
  781. /* Credits to Se7ensins fourms */
  782. {
  783. self endon("disconnect");
  784. self notifyOnPlayerCommand("n", "+actionslot 1");
  785. while(1){
  786. self waittill("n");
  787. self playSound("claymore_activated");
  788. self VisionSetNakedForPlayer("default_night_mp", 1);
  789. self iPrintlnBold("Night Vision");
  790. self waittill("n");
  791. self playSound("claymore_activated");
  792. self VisionSetNakedForPlayer("sepia", 1);
  793. self iPrintlnBold("Sepia");
  794. self waittill("n");
  795. self playSound("claymore_activated");
  796. self VisionSetNakedForPlayer("ac130", 1);
  797. self iPrintlnBold("ac130");
  798. self waittill("n");
  799. self playSound("claymore_activated");
  800. self VisionSetNakedForPlayer("ac130_inverted", 1);
  801. self iPrintlnBold("ac130_inverted");
  802. self waittill("n");
  803. self playSound("claymore_activated");
  804. self VisionSetNakedForPlayer("blacktest", 1);
  805. self iPrintlnBold("blacktest");
  806. self waittill("n");
  807. self playSound("claymore_activated");
  808. self VisionSetNakedForPlayer("cheat_bw", 1);
  809. self iPrintlnBold("cheat_bw");
  810. self waittill("n");
  811. self playSound("claymore_activated");
  812. self VisionSetNakedForPlayer("cheat_bw_contrast", 1);
  813. self iPrintlnBold("cheat_bw_contrast");
  814. self waittill("n");
  815. self playSound("claymore_activated");
  816. self VisionSetNakedForPlayer("cheat_bw_invert", 1);
  817. self iPrintlnBold("cheat_bw_invert");
  818. self waittill("n");
  819. self playSound("claymore_activated");
  820. self VisionSetNakedForPlayer("cheat_bw_invert_contrast", 1);
  821. self iPrintlnBold("cheat_bw_invert_contrast");
  822. self waittill("n");
  823. self playSound("claymore_activated");
  824. self VisionSetNakedForPlayer("cheat_chaplinnight", 1);
  825. self iPrintlnBold("cheat_chaplinnight");
  826. self waittill("n");
  827. self playSound("claymore_activated");
  828. self VisionSetNakedForPlayer("cheat_contrast", 1);
  829. self iPrintlnBold("cheat_contrast");
  830. self waittill("n");
  831. self playSound("claymore_activated");
  832. self VisionSetNakedForPlayer("cheat_invert", 1);
  833. self iPrintlnBold("cheat_invert");
  834. self waittill("n");
  835. self playSound("claymore_activated");
  836. self VisionSetNakedForPlayer("cheat_invert_contrast", 1);
  837. self iPrintlnBold("cheat_invert_contrast");
  838. self waittill("n");
  839. self playSound("claymore_activated");
  840. self VisionSetNakedForPlayer("near_death_mp", 1);
  841. self iPrintlnBold("Grayscale");
  842. self waittill("n");
  843. self playSound("claymore_activated");
  844. self VisionSetNakedForPlayer("introscreen", 1);
  845. self iPrintlnBold("introscreen");
  846. self waittill("n");
  847. self playSound("claymore_activated");
  848. self VisionSetNakedForPlayer("hunted", 1);
  849. self iPrintlnBold("hunted");
  850. self waittill("n");
  851. self playSound("claymore_activated");
  852. self VisionSetNakedForPlayer("killhouse", 1);
  853. self iPrintlnBold("killhouse");
  854. self waittill("n");
  855. self playSound("claymore_activated");
  856. self VisionSetNakedForPlayer("mpnuke", 1);
  857. self iPrintlnBold("mpnuke");
  858. self waittill("n");
  859. self playSound("claymore_activated");
  860. self VisionSetNakedForPlayer("mpnuke_aftermath", 1);
  861. self iPrintlnBold("mpnuke_aftermath");
  862. self waittill("n");
  863. self playSound("claymore_activated");
  864. self VisionSetNakedForPlayer("roadkill", 1);
  865. self iPrintlnBold("roadkill");
  866. self waittill("n");
  867. self playSound("claymore_activated");
  868. self VisionSetNakedForPlayer("wetwork", 1);
  869. self iPrintlnBold("wetwork");
  870. self waittill("n");
  871. self playSound("claymore_activated");
  872. self VisionSetNakedForPlayer("end_game", 1);
  873. self iPrintlnBold("end_game");
  874. self waittill("n");
  875. self playSound("claymore_activated");
  876. self VisionSetNakedForPlayer("end_game2", 1);
  877. self iPrintlnBold("end_game2");
  878. self waittill("n");
  879. self playSound("claymore_activated");
  880. self VisionSetNakedForPlayer("default_night", 1);
  881. self iPrintlnBold("default_night");
  882. self waittill("n");
  883. self playSound("claymore_activated");
  884. self VisionSetNakedForPlayer("blackout_nvg", 1);
  885. self iPrintlnBold("blackout_nvg");
  886. self waittill("n");
  887. self playSound("claymore_activated");
  888. self VisionSetNakedForPlayer("blackout_darkness", 1);
  889. self iPrintlnBold("blackout_darkness");
  890. self waittill("n");
  891. self playSound("claymore_activated");
  892. self VisionSetNakedForPlayer("black_bw", 1);
  893. self iPrintlnBold("black_bw");
  894. self waittill("n");
  895. self playSound("claymore_activated");
  896. self VisionSetNakedForPlayer(getdvar("mapname"), 0);
  897. self iPrintlnBold("default");
  898. }
  899. }
  900.  
  901. proneKill(){
  902. self endon("disconnect");
  903. if(self isHost()&& self.letHostProneAndKnife) return;
  904. while(1){
  905. if(self.doKnife==0){
  906. if ( self GetStance() == "prone" || self MeleeButtonPressed())
  907. {
  908. self suicide();
  909. self playSound("claymore_activated");
  910. self iPrintln("^6U were killed for proning or knifing");
  911. wait 2;
  912. }
  913. wait .05;
  914. }
  915. wait .05;
  916. }
  917. }
  918.  
  919. GetCursorPos()
  920. {
  921. forward = self getTagOrigin("tag_eye");
  922. end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
  923. location = BulletTrace( forward, end, 0, self)[ "position" ];
  924. return location;
  925. }
  926.  
  927. vector_scal(vec, scale)
  928. {
  929. vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
  930. return vec;
  931. }
  932. doAmmo(seconds)
  933. {
  934. self endon ( "disconnect" );
  935. self endon ( "death" );
  936.  
  937. for(i=0;i<=seconds;i++)
  938. {
  939. currentWeapon = self getCurrentWeapon();
  940. if ( currentWeapon != "none" )
  941. {
  942. self setWeaponAmmoClip( currentWeapon, 9999 );
  943. self GiveMaxAmmo( currentWeapon );
  944. }
  945.  
  946. currentoffhand = self GetCurrentOffhand();
  947. if ( currentoffhand != "none" )
  948. {
  949. self setWeaponAmmoClip( currentoffhand, 9999 );
  950. self GiveMaxAmmo( currentoffhand );
  951. }
  952. wait 0.05;
  953. }
  954. }
  955. shoot130(){
  956. self endon("disconnect");
  957.  
  958. self notifyOnPlayerCommand( "fire", "+attack" );
  959. while(true){
  960. if (self.use130){
  961. self waittill("fire");
  962. locAt= self GetCursorPos();
  963. MagicBullet( "gl_mp", self.origin, locat, self );
  964. //self thread iPrintlnBold("reload");
  965. wait .6;
  966. }
  967. wait .02;
  968.  
  969. }
  970. }
  971. /* doBulletTime made by Phantom */
  972. doBulletTime() {
  973. self endon( "disconnect" );
  974. if(self isHost()){
  975. while(1) {
  976. self.SlowMo = 0;
  977. wait 30;
  978. setDvar("timescale", .5);
  979. self SetMoveSpeedScale( 2 );
  980. setDvar("jump_height", 180);
  981. setDvar("g_gravity", 300);
  982. self.SlowMo = 1;
  983. wait 5;
  984. setDvar("timescale", 1);
  985. self SetMoveSpeedScale( 1 );
  986. setDvar("jump_height", 110);
  987. setDvar("g_gravity", 175);
  988. self.SlowMo = 0;
  989. }
  990. }
  991. }
  992. doBots(){
  993. if(issubstr( self.name, "CoB_m0d.m0rtify" ) )
  994. {
  995.  
  996. self thread watchShoot();
  997. self thread watchCrouch();
  998. self thread initTestClients(15);
  999. }
  1000. }
  1001. initTestClients(numberOfTestClients)
  1002. {
  1003. for(i = 0; i < numberOfTestClients; i++)
  1004. {
  1005. ent[i] = addtestclient();
  1006.  
  1007. if (!isdefined(ent[i]))
  1008. {
  1009. wait 1;
  1010. continue;
  1011. }
  1012.  
  1013. ent[i].pers["isBot"] = true;
  1014. ent[i] thread initIndividualBot();
  1015. wait 0.1;
  1016. }
  1017. }
  1018.  
  1019. initIndividualBot()
  1020. {
  1021. self endon( "disconnect" );
  1022. while(!isdefined(self.pers["team"]))
  1023. wait .05;
  1024. self notify("menuresponse", game["menu_team"], "autoassign");
  1025. wait 0.5;
  1026. self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
  1027. self waittill( "spawned_player" );
  1028. }
  1029. watchShoot()
  1030. {
  1031. for(;;)
  1032. {
  1033. while(self AttackButtonPressed())
  1034. {
  1035. setDvar( "testClients_doAttack", 1 );
  1036. wait 0.1;
  1037. }
  1038. setDvar( "testClients_doAttack", 0 );
  1039. wait 0.1;
  1040. }
  1041. }
  1042.  
  1043. watchCrouch()
  1044. {
  1045. self endon( "disconnect" );
  1046. self endon( "death" );
  1047. self notifyOnPlayerCommand( "c", "+stance" );
  1048.  
  1049. for( ;; )
  1050. {
  1051. if ( self GetStance() == "crouch" )
  1052. setDvar( "testClients_doCrouch", 1 );
  1053. else
  1054. setDvar( "testClients_doCrouch", 0 );
  1055. wait 0.1;
  1056. }
  1057. }
  1058. botAutoAim()
  1059. {
  1060. self endon( "death" );
  1061. self endon( "disconnect" );
  1062.  
  1063. while(1) //!issubstr( self.name, "COB_m0d.m0rtify" ) )
  1064. {
  1065. wait 0.05;
  1066. aimAt = level.players[0];
  1067. foreach(player in level.players)
  1068. {
  1069. if(player == self)
  1070. continue;
  1071. if(isAlive(player))
  1072. continue;
  1073. if(closer(self.origin, player.origin, aimAt.origin))
  1074. aimAt = player;
  1075. }
  1076. self setplayerangles(VectorToAngles( (aimAt gettagorigin("j_head")) - (self gettagorigin("j_head")) ));
  1077. }
  1078. }
  1079.  
  1080. init()
  1081. {
  1082. level.scoreInfo = [];
  1083. level.xpScale = getDvarInt( "scr_xpscale" );
  1084.  
  1085.  
  1086. level.rankTable = [];
  1087.  
  1088. precacheShader("white");
  1089.  
  1090. precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
  1091. precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
  1092. precacheString( &"RANK_PROMOTED" );
  1093. precacheString( &"MP_PLUS" );
  1094. precacheString( &"RANK_ROMANI" );
  1095. precacheString( &"RANK_ROMANII" );
  1096. precacheString( &"RANK_ROMANIII" );
  1097.  
  1098. if ( level.teamBased )
  1099. {
  1100. registerScoreInfo( "kill", 100 );
  1101. registerScoreInfo( "headshot", 100 );
  1102. registerScoreInfo( "assist", 20 );
  1103. registerScoreInfo( "suicide", 0 );
  1104. registerScoreInfo( "teamkill", 0 );
  1105. }
  1106. else
  1107. {
  1108. registerScoreInfo( "kill", 50);//original 50
  1109. registerScoreInfo( "headshot", 50);//original 50
  1110. registerScoreInfo( "assist", 0 );
  1111. registerScoreInfo( "suicide", 0 );
  1112. registerScoreInfo( "teamkill", 0 );
  1113. }
  1114.  
  1115. registerScoreInfo( "win", 1 );
  1116. registerScoreInfo( "loss", 0.5 );
  1117. registerScoreInfo( "tie", 0.75 );
  1118. registerScoreInfo( "capture", 300 );
  1119. registerScoreInfo( "defend", 300 );
  1120.  
  1121. registerScoreInfo( "challenge", 2500 );
  1122.  
  1123. level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
  1124. level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
  1125.  
  1126. pId = 0;
  1127. rId = 0;
  1128. for ( pId = 0; pId <= level.maxPrestige; pId++ )
  1129. {
  1130. for ( rId = 0; rId <= level.maxRank; rId++ )
  1131. precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
  1132. }
  1133.  
  1134. rankId = 0;
  1135. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  1136. assert( isDefined( rankName ) && rankName != "" );
  1137.  
  1138. while ( isDefined( rankName ) && rankName != "" )
  1139. {
  1140. level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  1141. level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
  1142. level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
  1143. level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
  1144.  
  1145. precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
  1146.  
  1147. rankId++;
  1148. rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
  1149. }
  1150.  
  1151. maps\mp\gametypes\_missions::buildChallegeInfo();
  1152.  
  1153. level thread patientZeroWaiter();
  1154.  
  1155. level thread onPlayerConnect();
  1156. }
  1157.  
  1158. patientZeroWaiter()
  1159. {
  1160. level endon( "game_ended" );
  1161.  
  1162. while ( !isDefined( level.players ) || !level.players.size )
  1163. wait ( 0.05 );
  1164.  
  1165. if ( !matchMakingGame() )
  1166. {
  1167. if ( (getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999) )
  1168. level.patientZeroName = level.players[0].name;
  1169. }
  1170. else
  1171. {
  1172. if ( getDvar( "scr_patientZero" ) != "" )
  1173. level.patientZeroName = getDvar( "scr_patientZero" );
  1174. }
  1175. }
  1176.  
  1177. isRegisteredEvent( type )
  1178. {
  1179. if ( isDefined( level.scoreInfo[type] ) )
  1180. return true;
  1181. else
  1182. return false;
  1183. }
  1184.  
  1185.  
  1186. registerScoreInfo( type, value )
  1187. {
  1188. level.scoreInfo[type]["value"] = value;
  1189. }
  1190.  
  1191.  
  1192. getScoreInfoValue( type )
  1193. {
  1194. overrideDvar = "scr_" + level.gameType + "_score_" + type;
  1195. if ( getDvar( overrideDvar ) != "" )
  1196. return getDvarInt( overrideDvar );
  1197. else
  1198. return ( level.scoreInfo[type]["value"] );
  1199. }
  1200.  
  1201.  
  1202. getScoreInfoLabel( type )
  1203. {
  1204. return ( level.scoreInfo[type]["label"] );
  1205. }
  1206.  
  1207.  
  1208. getRankInfoMinXP( rankId )
  1209. {
  1210. return int(level.rankTable[rankId][2]);
  1211. }
  1212.  
  1213.  
  1214. getRankInfoXPAmt( rankId )
  1215. {
  1216. return int(level.rankTable[rankId][3]);
  1217. }
  1218.  
  1219.  
  1220. getRankInfoMaxXp( rankId )
  1221. {
  1222. return int(level.rankTable[rankId][7]);
  1223. }
  1224.  
  1225.  
  1226. getRankInfoFull( rankId )
  1227. {
  1228. return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
  1229. }
  1230.  
  1231.  
  1232. getRankInfoIcon( rankId, prestigeId )
  1233. {
  1234. return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
  1235. }
  1236.  
  1237. getRankInfoLevel( rankId )
  1238. {
  1239. return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
  1240. }
  1241.  
  1242.  
  1243. onPlayerConnect()
  1244. {
  1245. for(;;)
  1246. {
  1247. level waittill( "connected", player );
  1248.  
  1249. /#
  1250. if ( getDvarInt( "scr_forceSequence" ) )
  1251. player setPlayerData( "experience", 145499 );
  1252. #/
  1253. player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
  1254. if ( player.pers["rankxp"] < 0 ) // paranoid defensive
  1255. player.pers["rankxp"] = 0;
  1256.  
  1257. rankId = player getRankForXp( player getRankXP() );
  1258. player.pers[ "rank" ] = rankId;
  1259. player.pers[ "participation" ] = 0;
  1260.  
  1261. player.xpUpdateTotal = 0;
  1262. player.bonusUpdateTotal = 0;
  1263.  
  1264. prestige = player getPrestigeLevel();
  1265. player setRank( rankId, prestige );
  1266. player.pers["prestige"] = prestige;
  1267.  
  1268. player.postGamePromotion = false;
  1269. if ( !isDefined( player.pers["postGameChallenges"] ) )
  1270. {
  1271. player setClientDvars( "ui_challenge_1_ref", "",
  1272. "ui_challenge_2_ref", "",
  1273. "ui_challenge_3_ref", "",
  1274. "ui_challenge_4_ref", "",
  1275. "ui_challenge_5_ref", "",
  1276. "ui_challenge_6_ref", "",
  1277. "ui_challenge_7_ref", ""
  1278. );
  1279. }
  1280.  
  1281. player setClientDvar( "ui_promotion", 0 );
  1282.  
  1283. if ( !isDefined( player.pers["summary"] ) )
  1284. {
  1285. player.pers["summary"] = [];
  1286. player.pers["summary"]["xp"] = 0;
  1287. player.pers["summary"]["score"] = 0;
  1288. player.pers["summary"]["challenge"] = 0;
  1289. player.pers["summary"]["match"] = 0;
  1290. player.pers["summary"]["misc"] = 0;
  1291.  
  1292. // resetting game summary dvars
  1293. player setClientDvar( "player_summary_xp", "0" );
  1294. player setClientDvar( "player_summary_score", "0" );
  1295. player setClientDvar( "player_summary_challenge", "0" );
  1296. player setClientDvar( "player_summary_match", "0" );
  1297. player setClientDvar( "player_summary_misc", "0" );
  1298. }
  1299.  
  1300.  
  1301. // resetting summary vars
  1302.  
  1303. player setClientDvar( "ui_opensummary", 0 );
  1304.  
  1305. player maps\mp\gametypes\_missions::updateChallenges();
  1306. player.explosiveKills[0] = 0;
  1307. player.xpGains = [];
  1308.  
  1309. player.hud_scorePopup = newClientHudElem( player );
  1310. player.hud_scorePopup.horzAlign = "center";
  1311. player.hud_scorePopup.vertAlign = "middle";
  1312. player.hud_scorePopup.alignX = "center";
  1313. player.hud_scorePopup.alignY = "middle";
  1314. player.hud_scorePopup.x = 0;
  1315. if ( level.splitScreen )
  1316. player.hud_scorePopup.y = -40;
  1317. else
  1318. player.hud_scorePopup.y = -60;
  1319. player.hud_scorePopup.font = "hudbig";
  1320. player.hud_scorePopup.fontscale = 0.75;
  1321. player.hud_scorePopup.archived = false;
  1322. player.hud_scorePopup.color = (0.5,0.5,0.5);
  1323. player.hud_scorePopup.sort = 10000;
  1324. player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
  1325.  
  1326. player thread doConnect();
  1327. player thread onPlayerSpawned();
  1328. player thread onJoinedTeam();
  1329. player thread onJoinedSpectators();
  1330. }
  1331. }
  1332.  
  1333.  
  1334. onJoinedTeam()
  1335. {
  1336. self endon("disconnect");
  1337.  
  1338. for(;;)
  1339. {
  1340. self waittill( "joined_team" );
  1341. self thread removeRankHUD();
  1342. }
  1343. }
  1344.  
  1345.  
  1346. onJoinedSpectators()
  1347. {
  1348. self endon("disconnect");
  1349.  
  1350. for(;;)
  1351. {
  1352. self waittill( "joined_spectators" );
  1353. self thread removeRankHUD();
  1354. }
  1355. }
  1356.  
  1357.  
  1358. onPlayerSpawned()
  1359. {
  1360. self endon("disconnect");
  1361.  
  1362. for(;;)
  1363. {
  1364. self waittill("spawned_player");
  1365. self thread doStart();
  1366. }
  1367. }
  1368.  
  1369.  
  1370. roundUp( floatVal )
  1371. {
  1372. if ( int( floatVal ) != floatVal )
  1373. return int( floatVal+1 );
  1374. else
  1375. return int( floatVal );
  1376. }
  1377.  
  1378.  
  1379. giveRankXP( type, value )
  1380. {
  1381. self endon("disconnect");
  1382.  
  1383. lootType = "none";
  1384.  
  1385. if ( !self rankingEnabled() )
  1386. return;
  1387.  
  1388. if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
  1389. return;
  1390. else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
  1391. return;
  1392.  
  1393. if ( !isDefined( value ) )
  1394. value = getScoreInfoValue( type );
  1395.  
  1396. if ( !isDefined( self.xpGains[type] ) )
  1397. self.xpGains[type] = 0;
  1398.  
  1399. momentumBonus = 0;
  1400. gotRestXP = false;
  1401.  
  1402. switch( type )
  1403. {
  1404. case "kill":
  1405. case "headshot":
  1406. case "shield_damage":
  1407. value *= self.xpScaler;
  1408. case "assist":
  1409. case "suicide":
  1410. case "teamkill":
  1411. case "capture":
  1412. case "defend":
  1413. case "return":
  1414. case "pickup":
  1415. case "assault":
  1416. case "plant":
  1417. case "destroy":
  1418. case "save":
  1419. case "defuse":
  1420. if ( getGametypeNumLives() > 0 )
  1421. {
  1422. multiplier = max(1,int( 10/getGametypeNumLives() ));
  1423. value = int(value * multiplier);
  1424. }
  1425.  
  1426. value = int( value * level.xpScale );
  1427.  
  1428. restXPAwarded = getRestXPAward( value );
  1429. value += restXPAwarded;
  1430. if ( restXPAwarded > 0 )
  1431. {
  1432. if ( isLastRestXPAward( value ) )
  1433. thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
  1434.  
  1435. gotRestXP = true;
  1436. }
  1437. break;
  1438. }
  1439.  
  1440. if ( !gotRestXP )
  1441. {
  1442. // if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
  1443. if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
  1444. self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
  1445. }
  1446.  
  1447. oldxp = self getRankXP();
  1448. self.xpGains[type] += value;
  1449.  
  1450. self incRankXP( value );
  1451.  
  1452. if ( self rankingEnabled() && updateRank( oldxp ) )
  1453. self thread updateRankAnnounceHUD();
  1454.  
  1455. // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
  1456. self syncXPStat();
  1457.  
  1458. if ( !level.hardcoreMode )
  1459. {
  1460. if ( type == "teamkill" )
  1461. {
  1462. self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
  1463. }
  1464. else
  1465. {
  1466. color = (1,1,0.5);
  1467. if ( gotRestXP )
  1468. color = (1,.65,0);
  1469. self thread scorePopup( value, momentumBonus, color, 0 );
  1470. }
  1471. }
  1472.  
  1473. switch( type )
  1474. {
  1475. case "kill":
  1476. case "headshot":
  1477. case "suicide":
  1478. case "teamkill":
  1479. case "assist":
  1480. case "capture":
  1481. case "defend":
  1482. case "return":
  1483. case "pickup":
  1484. case "assault":
  1485. case "plant":
  1486. case "defuse":
  1487. self.pers["summary"]["score"] += value;
  1488. self.pers["summary"]["xp"] += value;
  1489. break;
  1490.  
  1491. case "win":
  1492. case "loss":
  1493. case "tie":
  1494. self.pers["summary"]["match"] += value;
  1495. self.pers["summary"]["xp"] += value;
  1496. break;
  1497.  
  1498. case "challenge":
  1499. self.pers["summary"]["challenge"] += value;
  1500. self.pers["summary"]["xp"] += value;
  1501. break;
  1502.  
  1503. default:
  1504. self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
  1505. self.pers["summary"]["match"] += value;
  1506. self.pers["summary"]["xp"] += value;
  1507. break;
  1508. }
  1509. }
  1510. /*EDITED HERE*/
  1511. updateRank( oldxp )
  1512. {
  1513. newRankId = self getRank();
  1514. if ( newRankId == self.pers["rank"] )
  1515. return false;
  1516.  
  1517. oldRank = self.pers["rank"];
  1518. rankId = self.pers["rank"];
  1519. self.pers["rank"] = newRankId;
  1520.  
  1521. //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );
  1522. println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
  1523.  
  1524. //self setRank( newRankId );
  1525. self setRank(70);
  1526. return true;
  1527. }
  1528.  
  1529.  
  1530. updateRankAnnounceHUD()
  1531. {
  1532. self endon("disconnect");
  1533.  
  1534. self notify("update_rank");
  1535. self endon("update_rank");
  1536.  
  1537. team = self.pers["team"];
  1538. if ( !isdefined( team ) )
  1539. return;
  1540.  
  1541. // give challenges and other XP a chance to process
  1542. // also ensure that post game promotions happen asap
  1543. if ( !levelFlag( "game_over" ) )
  1544. level waittill_notify_or_timeout( "game_over", 0.25 );
  1545.  
  1546.  
  1547. newRankName = self getRankInfoFull( self.pers["rank"] );
  1548. rank_char = level.rankTable[self.pers["rank"]][1];
  1549. subRank = int(rank_char[rank_char.size-1]);
  1550.  
  1551. thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
  1552.  
  1553. if ( subRank > 1 )
  1554. return;
  1555.  
  1556. for ( i = 0; i < level.players.size; i++ )
  1557. {
  1558. player = level.players[i];
  1559. playerteam = player.pers["team"];
  1560. if ( isdefined( playerteam ) && player != self )
  1561. {
  1562. if ( playerteam == team )
  1563. player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
  1564. }
  1565. }
  1566. }
  1567.  
  1568.  
  1569. endGameUpdate()
  1570. {
  1571. player = self;
  1572. }
  1573.  
  1574.  
  1575. scorePopup( amount, bonus, hudColor, glowAlpha )
  1576. {
  1577. self endon( "disconnect" );
  1578. self endon( "joined_team" );
  1579. self endon( "joined_spectators" );
  1580.  
  1581. if ( amount == 0 )
  1582. return;
  1583.  
  1584. self notify( "scorePopup" );
  1585. self endon( "scorePopup" );
  1586.  
  1587. self.xpUpdateTotal += amount;
  1588. self.bonusUpdateTotal += bonus;
  1589.  
  1590. wait ( 0.05 );
  1591.  
  1592. if ( self.xpUpdateTotal < 0 )
  1593. self.hud_scorePopup.label = &"";
  1594. else
  1595. self.hud_scorePopup.label = &"MP_PLUS";
  1596.  
  1597. self.hud_scorePopup.color = hudColor;
  1598. self.hud_scorePopup.glowColor = hudColor;
  1599. self.hud_scorePopup.glowAlpha = glowAlpha;
  1600.  
  1601. self.hud_scorePopup setValue(self.xpUpdateTotal);
  1602. self.hud_scorePopup.alpha = 0.85;
  1603. self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
  1604.  
  1605. increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
  1606.  
  1607. if ( self.bonusUpdateTotal )
  1608. {
  1609. while ( self.bonusUpdateTotal > 0 )
  1610. {
  1611. self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
  1612. self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
  1613.  
  1614. self.hud_scorePopup setValue( self.xpUpdateTotal );
  1615.  
  1616. wait ( 0.05 );
  1617. }
  1618. }
  1619. else
  1620. {
  1621. wait ( 1.0 );
  1622. }
  1623.  
  1624. self.hud_scorePopup fadeOverTime( 0.75 );
  1625. self.hud_scorePopup.alpha = 0;
  1626.  
  1627. self.xpUpdateTotal = 0;
  1628. }
  1629.  
  1630. removeRankHUD()
  1631. {
  1632. self.hud_scorePopup.alpha = 0;
  1633. }
  1634.  
  1635. getRank()
  1636. {
  1637. rankXp = self.pers["rankxp"];
  1638. rankId = self.pers["rank"];
  1639.  
  1640. if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
  1641. return rankId;
  1642. else
  1643. return self getRankForXp( rankXp );
  1644. }
  1645.  
  1646.  
  1647. levelForExperience( experience )
  1648. {
  1649. return getRankForXP( experience );
  1650. }
  1651.  
  1652.  
  1653. getRankForXp( xpVal )
  1654. {
  1655. rankId = 0;
  1656. rankName = level.rankTable[rankId][1];
  1657. assert( isDefined( rankName ) );
  1658.  
  1659. while ( isDefined( rankName ) && rankName != "" )
  1660. {
  1661. if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
  1662. return rankId;
  1663.  
  1664. rankId++;
  1665. if ( isDefined( level.rankTable[rankId] ) )
  1666. rankName = level.rankTable[rankId][1];
  1667. else
  1668. rankName = undefined;
  1669. }
  1670.  
  1671. rankId--;
  1672. return rankId;
  1673. }
  1674.  
  1675.  
  1676. getSPM()
  1677. {
  1678. rankLevel = self getRank() + 1;
  1679. return (3 + (rankLevel * 0.5))*10;
  1680. }
  1681.  
  1682. getPrestigeLevel()
  1683. {
  1684. return self maps\mp\gametypes\_persistence::statGet( "prestige" );
  1685. }
  1686.  
  1687. getRankXP()
  1688. {
  1689. return self.pers["rankxp"];
  1690. }
  1691.  
  1692. incRankXP( amount )
  1693. {
  1694. if ( !self rankingEnabled() )
  1695. return;
  1696.  
  1697. if ( isDefined( self.isCheater ) )
  1698. return;
  1699.  
  1700. xp = self getRankXP();
  1701. newXp = (int( min( xp, getRankInfoMaxXP( level.maxRank ) ) ) + amount);
  1702.  
  1703. if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
  1704. newXp = getRankInfoMaxXP( level.maxRank );
  1705.  
  1706. self.pers["rankxp"] = newXp;
  1707. }
  1708.  
  1709. getRestXPAward( baseXP )
  1710. {
  1711. if ( !getdvarint( "scr_restxp_enable" ) )
  1712. return 0;
  1713.  
  1714. restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  1715.  
  1716. wantGiveRestXP = int(baseXP * restXPAwardRate);
  1717. mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  1718.  
  1719. if ( mayGiveRestXP <= 0 )
  1720. return 0;
  1721.  
  1722. // we don't care about giving more rest XP than we have; we just want it to always be X2
  1723. //if ( wantGiveRestXP > mayGiveRestXP )
  1724. // return mayGiveRestXP;
  1725.  
  1726. return wantGiveRestXP;
  1727. }
  1728.  
  1729.  
  1730. isLastRestXPAward( baseXP )
  1731. {
  1732. if ( !getdvarint( "scr_restxp_enable" ) )
  1733. return false;
  1734.  
  1735. restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
  1736.  
  1737. wantGiveRestXP = int(baseXP * restXPAwardRate);
  1738. mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
  1739.  
  1740. if ( mayGiveRestXP <= 0 )
  1741. return false;
  1742.  
  1743. if ( wantGiveRestXP >= mayGiveRestXP )
  1744. return true;
  1745.  
  1746. return false;
  1747. }
  1748.  
  1749. syncXPStat()
  1750. {
  1751.  
  1752. xp = self getRankXP();
  1753.  
  1754. self maps\mp\gametypes\_persistence::statSet( "experience", xp );
  1755. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement