Advertisement
Guest User

Mortifyd's Structure Mod

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