Advertisement
Guest User

Mortifyd's Structure Mod

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