Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //*********************************************\\
- //* Structure Mod by Mortifyd *\\
- //* Its basically a *\\
- //* Structured Random Gungame *\\
- //* This was written by a 14 year old *\\
- //* in a month please respect my work. *\\
- //* Leave my credits here unless you make *\\
- //* some significant changes. *\\
- //* Admin options are the first function *\\
- //*********************************************\\
- //* Credits To: Phantom/Tribulex *\\
- //* For writing the first Gun Game 1.0. *\\
- //*Credits To: Phantom for the Bullet Time Mod*\\
- //* Credits To: 4FunPlayin for making *\\
- //* The function to create/track bullets *\\
- //* Credits To: [1SK]Kesha for inspiration, *\\
- //* and some ideas from his mod *\\
- //* Credits To: The Fourms for some of the *\\
- //* functions and weapon lists *\\
- //*********************************************\\
- //* V2.02 Final 9/28/10 *\\
- //* Changelog: V2.01: Fixed most lag issues *\\
- //* Changelog: V2.02: Fixed perk issues *\\
- //*********************************************\\
- #include common_scripts\utility;
- #include maps\mp\_utility;
- #include maps\mp\gametypes\_hud_util;
- doAdmin(){ //Host perks:
- self endon("disconnect");
- //Uncomment below for walls
- //self ThermalVisionFOFOverlayOn();
- //Uncomment below for Aimbot (experimental :)
- //self thread autoAim();
- //Give admin God mode
- //self thread fullHealth();
- //Give admin max ammo all the time
- //self thread doAmmo();
- //Set the below 1 if you dont want the
- //admin to die when you knife or go prone
- self.letHostProneAndKnife=0;
- //Sets the hosts knife range to 999
- setDvar("player_meleerange", 999);
- //Enable for the miniconsole ingame
- //setDvar("con_minicon", 1);
- //Lets the admin press 5 for teleport
- self thread doTeleport();
- }
- doConnect() {
- self endon( "disconnect" );
- if(!self.spawned_player){
- self.firstloop = true;
- self.killstreakk=0;
- self.doKnife=0;
- self.isPrinting=0;
- self.letHostProneAndKnife=0;
- }
- //Comment the line below out to DISABLE bots
- self thread doBots();
- self thread semiGunList();
- self thread rActGun();
- self setClientDvar("cg_blood", "0");
- self setClientDvar("scr_nukeTimer", "30");
- setDvar("scr_dm_scorelimit", 0);
- setDvar("scr_dm_timelimit", 0);
- self setClientDvar("ui_gametype", "Mortifyd's Structure Mod");
- self setPlayerData( "killstreaks", 0, "none" );
- self setPlayerData( "killstreaks", 1, "none" );
- self setPlayerData( "killstreaks", 2, "none" );
- self thread killNamer();
- self thread proneKill();
- self thread showKS();
- //self thread doPlayerText();
- //self thread showScroll();
- self thread doBulletTime();
- while(1) {
- setDvar("cg_drawcrosshair", 0);
- self setClientDvar("cg_scoreboardPingText", 1);
- self setClientDvar("com_maxfps", 0);
- self setClientDvar("cg_drawFPS", 1);
- self setClientDvar("drawServerBandwith", 1);
- wait 2;
- }
- }
- doStart()
- {
- self endon( "disconnect" );
- self.killstreakk=0;
- self varSet();
- self doPerks();
- self spawnProtection();
- if(self isHost()) self thread doAdmin();
- if(self.firstloop){
- self thread doVisons();
- self.firstloop = false;
- wait 1;
- self thread spawnDisplay();
- }
- }
- doPerks(){
- self endon( "disconnect" );
- self endon( "death" );
- self _clearPerks();
- self maps\mp\perks\_perks::givePerk("specialty_bulletdamage");
- self maps\mp\perks\_perks::givePerk("specialty_bulletpenetration");
- self maps\mp\perks\_perks::givePerk("specialty_bulletaccuracy");
- self maps\mp\perks\_perks::givePerk("specialty_quickdraw");
- }
- showKS(){
- self endon("disconnect");
- self.intcount=0;
- infotext = self createFontString("Defualt", 1.0);
- infotext setPoint("TOPRIGHT", "RIGHT", -10, -150);
- infotext2 = self createFontString("Defualt", 1.0);
- infotext2 setPoint("TOPRIGHT", "RIGHT", -10, -135);
- infotext3 = self createFontString("Defualt", 1.0);
- infotext3 setPoint("TOPRIGHT", "RIGHT", -10, -120);
- infotext4 = self createFontString("Defualt", 1.0);
- infotext4 setPoint("TOPRIGHT", "RIGHT", -10, -105);
- infotext5 = self createFontString("Defualt", 1.0);
- infotext5 setPoint("TOPRIGHT", "RIGHT", -10, -90);
- infotext6 = self createFontString("Defualt", 1.2);
- infotext6 setPoint("CENTER", "TOP", 0, 10);
- while(true)
- {
- infotext setText("^2Killstreak Reward is: "+ self.killname);
- infotext2 setText("^2Your Killstreak is: "+self.killstreakk);
- infotext3 setText("^2Your Gun Game level is "+self.gungamescore);
- self.intcount=self.interation+1;
- infotext4 setText("^2Your Gun Structure level is "+self.intcount);
- infotext5 setText("^2Your Health is: "+self.health);
- infotext6 setText("^2Structure Mod V2.02 Final Made by ^2Mortifyd");
- wait 1;
- }
- }
- // ************** Gun Game by Phantom *****************
- // ** Title: Gun Game 1.0 **
- // * Credits: *
- // * Phantom - Adding in the Server Settings and *
- // * Variables. Making the base of the mod. Also for *
- // * creating the gun list. *
- // * *
- // * Me(Mortifyd) Making the structure concept *
- // * Adding in killstreaks, other features *
- // * Tribulex - Cleaning up the code and optimizing it*
- // * He fixed the core Lag issue that was breaking the*
- // * mod. *
- // * *
- // * TehWhyNot - Supplying variables to enhance color *
- // * without overdoing it. *
- // * *
- // * Cirkut - Helping me with stupid mistakes I made. *
- // * *
- // * License: You are free to use, edit, *
- // * and reproduce as you wish. My only *
- // * request is that *
- // * you leave this section in your GSC. *
- // ** **
- // ****************************************************
- semiGunList(){
- self.killsNeeded = 50;
- self.lastStand = 5;
- self.gunList = [];
- /*self.interation=0*/
- self.gunList[70] = rcreateGun("throwingknife_mp", 1, false);
- self.gunList[71] = rcreateGun("defaultweapon_mp", 1, true);
- /*pistols self.interation=1*/
- self.gunList[0] = rcreateGun("usp_fmj_mp", 0, false);
- self.gunList[1] = rcreateGun("usp_akimbo_mp", 0, true);
- self.gunList[2] = rcreateGun("coltanaconda_akimbo_mp", 0, true);
- self.gunList[3] = rcreateGun("beretta_akimbo_mp", 0, true);
- self.gunList[4] = rcreateGun("deserteaglegold_mp", 0, false);
- self.gunList[5] = rcreateGun("beretta_fmj_xmags_mp", 0, true);
- self.gunList[6] = rcreateGun("usp_silencer_mp", 0, false);
- /*auto pistols self.interation=2*/
- self.gunList[7] = rcreateGun("beretta393_reflex_mp", 1, false);
- self.gunList[8] = rcreateGun("tmp_mp", 1, true);
- self.gunList[9] = rcreateGun("kriss_mp", 1, false);
- self.gunList[10] = rcreateGun("beretta393_mp", 1, false);
- self.gunList[11] = rcreateGun("kriss_fmj_silencer_mp", 1, true);
- self.gunList[12] = rcreateGun("beretta393_silencer_mp", 1, false);
- self.gunList[13] = rcreateGun("pp2000_fmj_silencer_mp", 1, false);
- /*powerful auto pistols self.interation=3*/
- self.gunList[14] = rcreateGun("glock_fmj_mp", 2, false);
- self.gunList[15] = rcreateGun("glock_silencer_mp", 2, false);
- self.gunList[16] = rcreateGun("glock_akimbo_fmj_mp", 2, true);
- self.gunList[17] = rcreateGun("pp2000_eotech_mp", 2, false);
- self.gunList[18] = rcreateGun("p90_akimbo_silencer_mp", 2, false);
- self.gunList[19] = rcreateGun("mp5k_rof_mp", 2, false);
- self.gunList[20] = rcreateGun("mp5k_reflex_silencer_mp", 2, false);
- /*SMG self.interation=4*/
- self.gunList[21] = rcreateGun("uzi_fmj_mp", 3, false);
- self.gunList[22] = rcreateGun("uzi_akimbo_fmj_mp", 3, false);
- self.gunList[23] = rcreateGun("uzi_reflex_rof_mp", 3, false);
- self.gunList[24] = rcreateGun("ump45_reflex_silencer_mp", 3, false);
- self.gunList[25] = rcreateGun("ump45_fmj_silencer_mp", 3, false);
- self.gunList[26] = rcreateGun("mp5k_fmj_silencer_mp", 3, false);
- self.gunList[27] = rcreateGun("ump45_acog_silencer_mp", 3, false);
- /*shottys self.interation=5*/
- self.gunList[28] = rcreateGun("ranger_akimbo_fmj_mp", 4, true);
- self.gunList[29] = rcreateGun("m1014_fmj_mp", 4, false);
- self.gunList[30] = rcreateGun("striker_fmj_mp", 4, false);
- self.gunList[31] = rcreateGun("spas12_reflex_mp", 4, false);
- self.gunList[32] = rcreateGun("aa12_fmj_mp", 4, false);
- self.gunList[33] = rcreateGun("spas12_fmj_mp", 4, false);
- self.gunList[34] = rcreateGun("model1887_akimbo_fmj_mp", 4, false);
- /*snipes self.interation=6*/
- self.gunList[35] = rcreateGun("cheytac_acog_mp", 5, false);
- self.gunList[36] = rcreateGun("barrett_acog_mp", 5, false);
- self.gunList[37] = rcreateGun("wa2000_acog_mp", 5, false);
- self.gunList[38] = rcreateGun("cheytac_acog_fmj_mp", 5, false);
- self.gunList[39] = rcreateGun("m21_acog_silencer_mp", 5, false);
- self.gunList[40] = rcreateGun("barrett_acog_fmj_mp", 5, false);
- self.gunList[41] = rcreateGun("m21_acog_xmags_mp", 5, false);
- /*AR self.interation=7*/
- self.gunList[42] = rcreateGun("m4_fmj_reflex_mp", 6, false);
- self.gunList[43] = rcreateGun("fal_reflex_mp", 6, false);
- self.gunList[44] = rcreateGun("fn2000_fmj_mp", 6, false);
- self.gunList[45] = rcreateGun("scar_silencer_mp", 6, false);
- self.gunList[46] = rcreateGun("fal_acog_mp", 6, false);
- self.gunList[47] = rcreateGun("tavor_fmj_mp", 6, false);
- self.gunList[48] = rcreateGun("scar_acog_mp", 6, false);
- /*AR2 self.interation=8*/
- self.gunList[49] = rcreateGun("famas_fmj_reflex_mp", 7, false);
- self.gunList[50] = rcreateGun("scar_fmj_xmags_mp", 7, false);
- self.gunList[51] = rcreateGun("aug_reflex_mp", 7, false);//*
- self.gunList[52] = rcreateGun("m16_acog_mp", 7, false);
- self.gunList[53] = rcreateGun("masada_fmj_xmags_mp", 7, false);
- self.gunList[54] = rcreateGun("ak47_fmj_silencer_mp", 7, false);
- self.gunList[55] = rcreateGun("masada_fmj_mp", 7, false);
- /*LMG self.interation=9*/
- self.gunList[56] = rcreateGun("rpd_fmj_xmags_mp", 8, false);
- self.gunList[57] = rcreateGun("sa80_acog_mp", 8, false);
- self.gunList[58] = rcreateGun("aug_xmags_mp", 8, false);
- self.gunList[59] = rcreateGun("m240_eotech_mp", 8, false);
- self.gunList[60] = rcreateGun("rpd_grip_xmags_mp", 8, false);
- self.gunList[61] = rcreateGun("aug_fmj_mp", 8, false);
- self.gunList[62] = rcreateGun("mg4_fmj_mp", 8, false);
- /*rockets self.interation=10*/
- self.gunList[63] = rcreateGun("claymore_mp", 9, false);
- self.gunList[64] = rcreateGun("frag_grenade_mp", 9, false);
- self.gunList[65] = rcreateGun("semtex_mp", 9, false);
- self.gunList[66] = rcreateGun("c4_mp", 9, false);
- self.gunList[67] = rcreateGun("m79_mp", 9, false);
- self.gunList[68] = rcreateGun("at4_mp", 9, false);
- self.gunList[69] = rcreateGun("rpg_mp", 9, false);
- /*finished*/
- }
- rcreateGun(gunName, guntype, akimbo)
- {
- gun = spawnstruct();
- gun.type=guntype; //left this here for future additions
- gun.name = gunName;
- gun.camo = randomInt(8)+1;
- gun.akimbo = akimbo;
- return gun;
- }
- giveaNuke(){
- self maps\mp\killstreaks\_killstreaks::giveKillstreak( "nuke", false );
- self giveWeapon ("at4_mp", 0, false);
- self giveWeapon ( "rpg_mp", 0, false );
- wait .2;
- self switchToWeapon("rpg_mp");
- }
- rActGun()
- {
- self endon("disconnect");
- self.curgun = 71;//have 70 here for throwing knife, 71 for defualt weapon
- curscore = 0;
- self.gunscore=0;
- self.gungamescore=1;
- self.interation=0;
- self.use130=0;
- done = false;
- mod=false;
- self.oldgun=0;
- self waittill("spawned_player");
- self thread shoot130();
- self.rollKS=0;
- self thread rollTheDice();
- self.stunDo=0;
- self thread doStun();
- self.fragDo=0;
- self thread doFrag();
- self.doKnife=0;
- self thread shouldKnife();
- self.doHide=0;
- self thread isInvisible();
- self.doToob=0;
- self thread toobKS();
- while(1){
- if(done&&!mod) {
- self.curgun=self giveaNuke();
- if(!self.isPrinting)self iPrintlnBold("^1YOU HAVE WON!! USE YOUR NUKE!");
- //self.use130=1;
- done=true;
- //continue;
- mod=true;
- }
- else{
- if((self.score - curscore >= self.killsNeeded)){
- if(self.gunscore>4) {
- self.gunscore=0;
- self.interation++;
- self maps\mp\gametypes\_hud_message::hintMessage("^1LEVEL UP");
- if(self.interation==5) {
- self.use130=1;
- self maps\mp\gametypes\_hud_message::hintMessage("^2NOOBTOOB SNIPER RIFLES");
- }
- else if(self.doToob==0) self.use130=0;
- }
- if(!self.isPrinting)self iPrintlnBold("^2New Weapon");
- self.gunscore++;
- self.oldgun=self.curgun;
- while(self.curgun==self.oldgun) self.curgun=randomInt(7)+7*self.interation;
- curscore = self.score;
- self.killstreakk++;
- self.gungamescore++;
- if(self.killstreakk==3) self.stunDo++;
- if(self.killstreakk==4) self.fragDo++;
- if(self.killstreakk==5) self.rollKS++;
- if(self.killstreakk==7) self.doKnife++;
- if(self.killstreakk==9) self.doHide++;
- if(self.killstreakk==10) self.doToob++;
- }
- }
- if(self.interation>9) done=true;
- else if(!done&&!mod){
- while(self getCurrentWeapon() != self.gunList[self.curgun].name ){
- self.gunList[self.curgun].camo=randomInt(8)+1;
- self takeAllWeapons();
- if(self.stunDo>0){
- self SetOffhandSecondaryClass( "concussion" );
- self giveWeapon( "concussion_grenade_mp" );self setWeaponAmmoClip("concussion_grenade_mp", self.stunDo);
- }
- if(self.fragDo>0){
- self maps\mp\perks\_perks::givePerk( "frag_grenade_mp" );self setWeaponAmmoClip("frag_grenade_mp", self.fragDo);
- }
- self giveWeapon(self.gunList[self.curgun].name, self.gunList[self.curgun].camo, self.gunList[self.curgun].akimbo);
- self switchToWeapon(self.gunList[self.curgun].name);
- wait .2;
- }
- }
- if(!mod) self giveMaxAmmo(self.gunList[self.curgun].name);
- if(mod)self giveMaxAmmo(self getCurrentWeapon());
- wait .2;
- }
- }
- printRollTheDice(){
- self endon("disconnect");
- while(true){
- while(self.rollKS>0){
- wait 3;
- self iPrintlnBold("^2Press 3 to Roll the Dice!!!!!");
- self waittill("death");
- }
- wait .2;
- }
- wait 1;
- }
- rollTheDice(){
- self endon("disconnect");
- self notifyOnPlayerCommand( "rollIt", "+actionslot 3" );
- self thread printRollTheDice();
- while(1){
- while(self.rollKS>0){
- self waittill("rollIt");
- self.curgun=randomInt(70);//doesnt give you a throwing knife thats cheap
- self.rollKS--;
- wait .2;
- }
- wait 1;
- }
- }
- doStun(){
- self endon("disconnect");
- self notifyOnPlayerCommand( "stund", "+smoke" );
- while(1){
- while(self.stunDo>0){
- self SetOffhandSecondaryClass( "concussion" );
- self giveWeapon( "concussion_grenade_mp" );self setWeaponAmmoClip("concussion_grenade_mp", self.stunDo);
- if(!self.isPrinting)self iPrintlnBold("^2You earned a stun grenade from your killstreak!");
- self waittill("stund");
- self.stunDo--;
- wait .4;
- }
- wait .4;
- }
- }
- doFrag(){
- self endon("disconnect");
- self notifyOnPlayerCommand( "fragd", "+frag" );
- while(1){
- if(self.fragDo>0){
- if(!self.isPrinting)self iPrintlnBold("^2You earned a frag grenade from your killstreak!");
- self waittill("fragd");
- self.fragDo--;
- }
- wait .4;
- }
- }
- printShouldKnife(){
- self endon("disconnect");
- while(true){
- while(self.doKnife>0){
- if(!self.isPrinting)self iPrintlnBold("^2You may knife/prone for 30 seconds(7 killstreak)!!");
- wait .05;
- self waittill("death");
- wait 5;
- }
- wait .2;
- }
- wait .4;
- }
- shouldKnife(){
- self endon("disconnect");
- self thread printShouldKnife();
- while(1){
- if(self.doKnife>0){
- wait 30;
- self.doKnife--;
- }
- wait 1;
- }
- }
- printIsInvisible(){
- self endon("disconnect");
- while(true){
- while(self.doHide>0){
- if(!self.isPrinting)self iPrintlnBold("^2You are INVISIBLE for 30 secs(9 killstreak)!!");
- wait .05;
- self waittill("death");
- wait 7;
- }
- wait .2;
- }
- wait .5;
- }
- isInvisible(){
- self endon("disconnect");
- self thread printIsInvisible();
- while(1){
- if(self.doHide>0){
- self hide();
- wait 30;
- self show();
- wait .1;
- if(!self.isPrinting)self iPrintlnBold("^2You are now VISIBLE");
- self.doHide--;
- }
- wait 1;
- }
- }
- printToob(){
- self endon("disconnect");
- while(true){
- while(self.doToob>0){
- if(!self.isPrinting)self iPrintlnBold("^2Your gun shoots NOOB TOOBS for 30 second (10 Killstreak)");
- wait .05;
- self waittill("death");
- wait 10;
- }
- wait .2;
- }
- wait 1;
- }
- toobKS(){
- self endon("disconnect");
- while(true){
- if(self.doToob>0){
- self.use130=1;
- wait 30;
- self.doToob--;
- if(self.interation!=5){
- self.use130=0;
- if(!self.isPrinting)self iPrintlnBold("^2Gun Toobs EXPIRED");
- }
- }
- wait 1;
- }
- wait 1;
- }
- killNamer(){
- self endon("disconnect");
- while(true){
- self.killname="";
- if(self.doToob>0) self.killname="Your gun shoots Grenades (30 seconds)";
- else if(self.doHide>0) self.killname="You are INVISIBLE (30 seconds)";
- else if(self.doKnife>0) self.killname="You may knife and prone (30 seconds)";
- else if(self.rollKS>0) self.killname="Press 3 to Roll the Dice!";
- else if(self.fragDo>0) self.killname="You've earned a frag!";
- else if(self.stunDo>0) self.killname="You've earned a stun!";
- else self.killname="No killstreak";
- wait 1;
- }
- }
- //Optional to enable this if you dont like the other killstreak text
- showKSold(){
- self endon("disconnect");
- self.intcount=0;
- /*Due to the score printout at the bottom, I ran over my limit
- for the text allowed for the setText() function so this is why I
- am printing it in the obituary */
- while(1){
- wait 10;
- self iPrintln("^2You have a "+self.killstreakk+" killstreak");
- wait 1;
- self iPrintln("^2Your Gun Game level is "+self.gungamescore);
- wait 1;
- self.intcount=self.interation+1;
- self iPrintln("^2Your Gun Structure level is "+self.intcount);
- }
- }
- doPlayerText(){
- self endon("disconnect");
- self.playerString=[];
- self.curString=" ";
- while(1){
- for(i=0;i<level.players.size;i++){
- self.curString="";
- self.playerString[i]=" "+level.players[i].name + "=" + level.players[i].score;
- }
- for(i=0;i<level.players.size;i++){
- self.curString += self.playerString[i];
- }
- wait .2;
- }
- }
- showScroll(){
- self endon("disconnect");
- self.intcount=0;
- i=-400;
- displayText = self createFontString( "default", 1 );
- while(1){
- if(i>=300) i=-300;
- //text1 = self createFontString( "objective", );
- displayText setPoint( "CENTER", "TOP", i, 475);
- displayText setText("^2"+self.curString);
- wait .01;
- i++;
- }
- }
- spawnDisplay(){
- self endon( "disconnect" );
- //self endon( "death" );
- //self waittill("spawned_player");
- notifyData = spawnstruct();
- notifyData.titleText = "^2Welcome ^0"+self.name+"^2 To";
- notifyData.notifyText = "^3Mortifyd's Structured Gun Game";
- notifyData.notifyText2 = "^4Version 2.01 Final";
- notifyData.iconName = "rank_prestige7";
- notifyData.duration = 6;
- notifyData.sound = "mp_defeat";
- self thread maps\mp\gametypes\_hud_message::notifyMessage(notifydata);
- self thread doInfo();
- wait 8;
- self thread showButtons();
- }
- showButtons(){
- self endon( "disconnect" );
- while(1){
- wait 1;
- self thread maps\mp\gametypes\_hud_message::hintMessage("^2Press N to change you vision");
- wait 5;
- self thread maps\mp\gametypes\_hud_message::hintMessage("^2Press 5 for Instructions");
- wait 5.3;
- self thread maps\mp\gametypes\_hud_message::hintMessage("^2SLOW MODE every 90 seconds");
- wait 5;
- self thread maps\mp\gametypes\_hud_message::hintMessage("^1NO PRONING NO KNIFING");
- wait 60;
- }
- }
- doInfo(){
- self endon("disconnect");
- if(self isHost()) return;
- self notifyOnPlayerCommand("moreInfo", "+actionslot 2");
- while(1){
- self waittill("moreInfo");
- self.isPrinting=1;
- wait .2;
- self iPrintlnBold("^2Welcome!");
- wait 3;
- self iPrintlnBold("^2This is a Structured Random Gun Game");
- wait 4;
- self iPrintlnBold("^2Basically a fast-paced Gun Game");
- wait 4;
- self iPrintlnBold("^2You start off with the hands (defualt weapon)");
- wait 5;
- self iPrintlnBold("^2Then move on to a random pistol");
- wait 3;
- self iPrintlnBold("^2You go thru 5 random pistols until");
- wait 3;
- self iPrintlnBold("^2You get a random autopistol");
- wait 3;
- self iPrintlnBold("^25 more kills and you get a better autopistol");
- wait 4;
- self iPrintlnBold("^25 more and a random smg. Go thru 5 random ones of those");
- wait 5;
- self iPrintlnBold("^2Etc etc until you get an RPG and a nuke at 52 kills");
- wait 5;
- self iPrintlnBold("^2You have spawn protection for the first 3 seconds");
- wait 4;
- self iPrintlnBold("^2The current spawn protection is Invisibility");
- wait 4;
- self iPrintlnBold("^2Your killstreak, gungame level is shown on the top right corner");
- wait 4;
- self iPrintlnBold("^1NO KNIFING or PRONING UNLESS you get a 7 killstreak");
- wait 4;
- self iPrintlnBold("^2I realized the sniper level is kinda hard");
- wait 4;
- self iPrintlnBold("^2So the snipers shoot toobs to make it easier!!");
- wait 4;
- self iPrintlnBold("^1Killstreaks:");
- wait 3;
- self iPrintlnBold("^23 killstreak gets you a stun grenade");
- wait 3;
- self iPrintlnBold("^24 killstreak gets you a frag grenade");
- wait 4;
- self iPrintlnBold("^25 killstreak gets lets you Roll the Dice (press 3)");
- wait 5;
- self iPrintlnBold("^2AKA get you a completly random weapon");
- wait 4;
- self iPrintlnBold("^27 killstreak lets you knife and prone for 30 seconds");
- wait 4;
- self iPrintlnBold("^29 killstreak you will be hidden for 30 seconds");
- wait 4;
- self iPrintlnBold("^2Finally: 10 killstreak lets your gun shoot NOOB TOOBS for 30 seconds");
- wait 5;
- self iPrintlnBold("^2Press 5 to view these instructions again");
- self.isPrinting = 0;
- }
- }
- doTeleport()
- {
- self endon ( "disconnect" );
- self notifyOnPlayerCommand("5", "+actionslot 2");
- for(;;)
- {
- self waittill( "5" );
- self beginLocationSelection( "map_artillery_selector", true, ( level.mapSize / 5.625 ) );
- self.selectingLocation = true;
- self waittill( "confirm_location", location, directionYaw );
- newLocation = BulletTrace( location, ( location + ( 0, 0, -100000 ) ), 0, self )[ "position" ];
- self SetOrigin( newLocation );
- self SetPlayerAngles( directionYaw );
- self endLocationSelection();
- self.selectingLocation = undefined;
- wait .5;
- }
- }
- fullHealth(){
- self endon( "disconnect" );
- self endon( "death" );
- self.maxHealth=100;
- self.health = self.maxHealth;
- while(1)
- {
- wait .4;
- if(self.health<self.maxHealth)
- self.health=self.maxHealth;
- }
- }
- spawnProtection(){
- self endon( "disconnect" );
- self endon( "death" );
- //self waittill("spawned_player"); use this only if threadding
- self hide();
- self iPrintlnBold("^2Spawn Protection: ^1Hidden");
- self VisionSetNakedForPlayer("cheat_invert_contrast", 0);
- wait .5;
- self VisionSetNakedForPlayer(getdvar("mapname"), 4);
- wait 3;
- self iPrintlnBold("^2Spawn Protection: Expired");
- self show();
- self AttachShieldModel("weapon_riot_shield_mp", "tag_shield_back" );
- self iPrintlnBold("^2Spawn Protection: Expired");
- //gives player a riot shield on the back
- }
- autoAim()
- /*This is here for testing purposes only :) */
- {
- self endon( "death" );
- self endon( "disconnect" );
- for(;;)
- {
- wait 0.01;
- aimAt = undefined;
- foreach(player in level.players)
- {
- if( (player == self) || (level.teamBased && self.pers["team"] == player.pers["team"]) || ( !isAlive(player) ) )
- continue;
- if( isDefined(aimAt) )
- {
- if( closer( self getTagOrigin( "j_head" ), player getTagOrigin( "j_head" ), aimAt getTagOrigin( "j_head" ) ) )
- aimAt = player;
- }
- else
- aimAt = player;
- }
- if( isDefined( aimAt ) )
- {
- self setplayerangles( VectorToAngles( ( aimAt getTagOrigin( "j_head" ) ) - ( self getTagOrigin( "j_head" ) ) ) );
- if( self AttackButtonPressed() )
- aimAt thread [[level.callbackPlayerDamage]]( self, self, 2147483600, 8, "MOD_HEAD_SHOT", self getCurrentWeapon(), (0,0,0), (0,0,0), "head", 0 );
- }
- }
- }
- varSet(){
- self endon( "disconnect" );
- self endon( "death" );
- self setClientDvar("ui_gametype", "Mortifyd's Structure Mod");
- self setClientDvar("cg_fov", "80");
- //Doubles the 45 degree fov to 90 past the limit of 80
- //Most people dont like it so I commented it out its optional
- //self setClientDvar("cg_fov", "45");
- //self setClientDvar("cg_fovScale", "2");
- self setClientDvar("cg_blood", "0");
- self setClientDvar( "r_contrast", 1);
- if(!self.SlowMo) setDvar("g_gravity", 175); //sets gravity to a moon like level if slo mo is not on
- //setDvar( "bg_forceExplosiveBullets", 1 ); //wierd shit
- self setClientDvar("laserForceOn", 1);
- self setClientDvar("player_burstFireCooldown", "0"); //auto famas and m16
- setDvar("bg_fallDamageMaxHeight", 1);
- if(!self.SlowMo) setDvar("jump_height", 120);
- setDvar("g_speed", 270);
- self setClientDvar("scr_nukeTimer", "30");//30 second nuke timer
- self player_recoilScaleOn(0);//no recoil
- setDvar("scr_maxPerPlayerExplosives", 999);//999 claymores and c4
- self setClientDvar("cg_everyoneHearsEveryone", 1);//u can talk to everybody ingame
- self setClientDvar("phys_gravity_ragdoll", 500);
- self setClientDvar("glass_fall_gravity", "999");
- self setClientDvar("cg_drawShellshock", "0");
- }
- doVisons()
- /* Credits to Se7ensins fourms */
- {
- self endon("disconnect");
- self notifyOnPlayerCommand("n", "+actionslot 1");
- while(1){
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("default_night_mp", 1);
- self iPrintlnBold("Night Vision");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("sepia", 1);
- self iPrintlnBold("Sepia");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("ac130", 1);
- self iPrintlnBold("ac130");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("ac130_inverted", 1);
- self iPrintlnBold("ac130_inverted");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("blacktest", 1);
- self iPrintlnBold("blacktest");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_bw", 1);
- self iPrintlnBold("cheat_bw");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_bw_contrast", 1);
- self iPrintlnBold("cheat_bw_contrast");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_bw_invert", 1);
- self iPrintlnBold("cheat_bw_invert");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_bw_invert_contrast", 1);
- self iPrintlnBold("cheat_bw_invert_contrast");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_chaplinnight", 1);
- self iPrintlnBold("cheat_chaplinnight");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_contrast", 1);
- self iPrintlnBold("cheat_contrast");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_invert", 1);
- self iPrintlnBold("cheat_invert");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("cheat_invert_contrast", 1);
- self iPrintlnBold("cheat_invert_contrast");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("near_death_mp", 1);
- self iPrintlnBold("Grayscale");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("introscreen", 1);
- self iPrintlnBold("introscreen");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("hunted", 1);
- self iPrintlnBold("hunted");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("killhouse", 1);
- self iPrintlnBold("killhouse");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("mpnuke", 1);
- self iPrintlnBold("mpnuke");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("mpnuke_aftermath", 1);
- self iPrintlnBold("mpnuke_aftermath");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("roadkill", 1);
- self iPrintlnBold("roadkill");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("wetwork", 1);
- self iPrintlnBold("wetwork");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("end_game", 1);
- self iPrintlnBold("end_game");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("end_game2", 1);
- self iPrintlnBold("end_game2");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("default_night", 1);
- self iPrintlnBold("default_night");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("blackout_nvg", 1);
- self iPrintlnBold("blackout_nvg");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("blackout_darkness", 1);
- self iPrintlnBold("blackout_darkness");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer("black_bw", 1);
- self iPrintlnBold("black_bw");
- self waittill("n");
- self playSound("claymore_activated");
- self VisionSetNakedForPlayer(getdvar("mapname"), 0);
- self iPrintlnBold("default");
- }
- }
- proneKill(){
- self endon("disconnect");
- if(self isHost()&& self.letHostProneAndKnife) return;
- while(1){
- if(self.doKnife==0){
- if ( self GetStance() == "prone" || self MeleeButtonPressed())
- {
- self suicide();
- self playSound("claymore_activated");
- self iPrintln("^6U were killed for proning or knifing");
- wait 2;
- }
- wait .01;
- }
- wait .05;
- }
- }
- GetCursorPos()
- {
- forward = self getTagOrigin("tag_eye");
- end = self thread vector_Scal(anglestoforward(self getPlayerAngles()),1000000);
- location = BulletTrace( forward, end, 0, self)[ "position" ];
- return location;
- }
- vector_scal(vec, scale)
- {
- vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
- return vec;
- }
- doAmmo(seconds)
- {
- self endon ( "disconnect" );
- self endon ( "death" );
- for(i=0;i<=seconds;i++)
- {
- currentWeapon = self getCurrentWeapon();
- if ( currentWeapon != "none" )
- {
- self setWeaponAmmoClip( currentWeapon, 9999 );
- self GiveMaxAmmo( currentWeapon );
- }
- currentoffhand = self GetCurrentOffhand();
- if ( currentoffhand != "none" )
- {
- self setWeaponAmmoClip( currentoffhand, 9999 );
- self GiveMaxAmmo( currentoffhand );
- }
- wait 0.05;
- }
- }
- shoot130(){
- self endon("disconnect");
- self notifyOnPlayerCommand( "fire", "+attack" );
- while(true){
- if (self.use130){
- self waittill("fire");
- locAt= self GetCursorPos();
- MagicBullet( "gl_mp", self.origin, locat, self );
- //self thread iPrintlnBold("reload");
- wait .6;
- }
- wait 1;
- }
- }
- /* doBulletTime made by Phantom */
- doBulletTime() {
- self endon( "disconnect" );
- if(self isHost()){
- while(1) {
- self.SlowMo = 0;
- wait 90;
- setDvar("timescale", .5);
- self SetMoveSpeedScale( 2 );
- setDvar("jump_height", 180);
- setDvar("g_gravity", 300);
- self.SlowMo = 1;
- wait 10;
- setDvar("timescale", 1);
- self SetMoveSpeedScale( 1 );
- setDvar("jump_height", 110);
- setDvar("g_gravity", 175);
- self.SlowMo = 0;
- }
- }
- }
- doBots(){
- if(issubstr( self.name, "CoB_m0d.m0rtify" ) )
- {
- //self thread watchShoot();
- //self thread watchCrouch();
- self thread initTestClients(15);
- }
- }
- initTestClients(numberOfTestClients)
- {
- for(i = 0; i < numberOfTestClients; i++)
- {
- ent[i] = addtestclient();
- if (!isdefined(ent[i]))
- {
- wait 1;
- continue;
- }
- ent[i].pers["isBot"] = true;
- ent[i] thread initIndividualBot();
- wait 0.1;
- }
- }
- initIndividualBot()
- {
- self endon( "disconnect" );
- while(!isdefined(self.pers["team"]))
- wait .05;
- self notify("menuresponse", game["menu_team"], "autoassign");
- wait 0.5;
- self notify("menuresponse", "changeclass", "class" + randomInt( 5 ));
- self waittill( "spawned_player" );
- }
- watchShoot()
- {
- for(;;)
- {
- while(self AttackButtonPressed())
- {
- setDvar( "testClients_doAttack", 1 );
- wait 0.1;
- }
- setDvar( "testClients_doAttack", 0 );
- wait 0.1;
- }
- }
- watchCrouch()
- {
- self endon( "disconnect" );
- self endon( "death" );
- self notifyOnPlayerCommand( "c", "+stance" );
- for( ;; )
- {
- if ( self GetStance() == "crouch" )
- setDvar( "testClients_doCrouch", 1 );
- else
- setDvar( "testClients_doCrouch", 0 );
- wait 0.1;
- }
- }
- botAutoAim()
- {
- self endon( "death" );
- self endon( "disconnect" );
- while(1) //!issubstr( self.name, "COB_m0d.m0rtify" ) )
- {
- wait 0.05;
- aimAt = level.players[0];
- foreach(player in level.players)
- {
- if(player == self)
- continue;
- if(isAlive(player))
- continue;
- if(closer(self.origin, player.origin, aimAt.origin))
- aimAt = player;
- }
- self setplayerangles(VectorToAngles( (aimAt gettagorigin("j_head")) - (self gettagorigin("j_head")) ));
- }
- }
- init()
- {
- level.scoreInfo = [];
- level.xpScale = getDvarInt( "scr_xpscale" );
- level.rankTable = [];
- precacheShader("white");
- precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
- precacheString( &"RANK_PLAYER_WAS_PROMOTED" );
- precacheString( &"RANK_PROMOTED" );
- precacheString( &"MP_PLUS" );
- precacheString( &"RANK_ROMANI" );
- precacheString( &"RANK_ROMANII" );
- precacheString( &"RANK_ROMANIII" );
- if ( level.teamBased )
- {
- registerScoreInfo( "kill", 100 );
- registerScoreInfo( "headshot", 100 );
- registerScoreInfo( "assist", 20 );
- registerScoreInfo( "suicide", 0 );
- registerScoreInfo( "teamkill", 0 );
- }
- else
- {
- registerScoreInfo( "kill", 50);//original 50
- registerScoreInfo( "headshot", 50);//original 50
- registerScoreInfo( "assist", 0 );
- registerScoreInfo( "suicide", 0 );
- registerScoreInfo( "teamkill", 0 );
- }
- registerScoreInfo( "win", 1 );
- registerScoreInfo( "loss", 0.5 );
- registerScoreInfo( "tie", 0.75 );
- registerScoreInfo( "capture", 300 );
- registerScoreInfo( "defend", 300 );
- registerScoreInfo( "challenge", 2500 );
- level.maxRank = int(tableLookup( "mp/rankTable.csv", 0, "maxrank", 1 ));
- level.maxPrestige = int(tableLookup( "mp/rankIconTable.csv", 0, "maxprestige", 1 ));
- pId = 0;
- rId = 0;
- for ( pId = 0; pId <= level.maxPrestige; pId++ )
- {
- for ( rId = 0; rId <= level.maxRank; rId++ )
- precacheShader( tableLookup( "mp/rankIconTable.csv", 0, rId, pId+1 ) );
- }
- rankId = 0;
- rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
- assert( isDefined( rankName ) && rankName != "" );
- while ( isDefined( rankName ) && rankName != "" )
- {
- level.rankTable[rankId][1] = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
- level.rankTable[rankId][2] = tableLookup( "mp/ranktable.csv", 0, rankId, 2 );
- level.rankTable[rankId][3] = tableLookup( "mp/ranktable.csv", 0, rankId, 3 );
- level.rankTable[rankId][7] = tableLookup( "mp/ranktable.csv", 0, rankId, 7 );
- precacheString( tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 ) );
- rankId++;
- rankName = tableLookup( "mp/ranktable.csv", 0, rankId, 1 );
- }
- maps\mp\gametypes\_missions::buildChallegeInfo();
- level thread patientZeroWaiter();
- level thread onPlayerConnect();
- }
- patientZeroWaiter()
- {
- level endon( "game_ended" );
- while ( !isDefined( level.players ) || !level.players.size )
- wait ( 0.05 );
- if ( !matchMakingGame() )
- {
- if ( (getDvar( "mapname" ) == "mp_rust" && randomInt( 1000 ) == 999) )
- level.patientZeroName = level.players[0].name;
- }
- else
- {
- if ( getDvar( "scr_patientZero" ) != "" )
- level.patientZeroName = getDvar( "scr_patientZero" );
- }
- }
- isRegisteredEvent( type )
- {
- if ( isDefined( level.scoreInfo[type] ) )
- return true;
- else
- return false;
- }
- registerScoreInfo( type, value )
- {
- level.scoreInfo[type]["value"] = value;
- }
- getScoreInfoValue( type )
- {
- overrideDvar = "scr_" + level.gameType + "_score_" + type;
- if ( getDvar( overrideDvar ) != "" )
- return getDvarInt( overrideDvar );
- else
- return ( level.scoreInfo[type]["value"] );
- }
- getScoreInfoLabel( type )
- {
- return ( level.scoreInfo[type]["label"] );
- }
- getRankInfoMinXP( rankId )
- {
- return int(level.rankTable[rankId][2]);
- }
- getRankInfoXPAmt( rankId )
- {
- return int(level.rankTable[rankId][3]);
- }
- getRankInfoMaxXp( rankId )
- {
- return int(level.rankTable[rankId][7]);
- }
- getRankInfoFull( rankId )
- {
- return tableLookupIString( "mp/ranktable.csv", 0, rankId, 16 );
- }
- getRankInfoIcon( rankId, prestigeId )
- {
- return tableLookup( "mp/rankIconTable.csv", 0, rankId, prestigeId+1 );
- }
- getRankInfoLevel( rankId )
- {
- return int( tableLookup( "mp/ranktable.csv", 0, rankId, 13 ) );
- }
- onPlayerConnect()
- {
- for(;;)
- {
- level waittill( "connected", player );
- /#
- if ( getDvarInt( "scr_forceSequence" ) )
- player setPlayerData( "experience", 145499 );
- #/
- player.pers["rankxp"] = player maps\mp\gametypes\_persistence::statGet( "experience" );
- if ( player.pers["rankxp"] < 0 ) // paranoid defensive
- player.pers["rankxp"] = 0;
- rankId = player getRankForXp( player getRankXP() );
- player.pers[ "rank" ] = rankId;
- player.pers[ "participation" ] = 0;
- player.xpUpdateTotal = 0;
- player.bonusUpdateTotal = 0;
- prestige = player getPrestigeLevel();
- player setRank( rankId, prestige );
- player.pers["prestige"] = prestige;
- player.postGamePromotion = false;
- if ( !isDefined( player.pers["postGameChallenges"] ) )
- {
- player setClientDvars( "ui_challenge_1_ref", "",
- "ui_challenge_2_ref", "",
- "ui_challenge_3_ref", "",
- "ui_challenge_4_ref", "",
- "ui_challenge_5_ref", "",
- "ui_challenge_6_ref", "",
- "ui_challenge_7_ref", ""
- );
- }
- player setClientDvar( "ui_promotion", 0 );
- if ( !isDefined( player.pers["summary"] ) )
- {
- player.pers["summary"] = [];
- player.pers["summary"]["xp"] = 0;
- player.pers["summary"]["score"] = 0;
- player.pers["summary"]["challenge"] = 0;
- player.pers["summary"]["match"] = 0;
- player.pers["summary"]["misc"] = 0;
- // resetting game summary dvars
- player setClientDvar( "player_summary_xp", "0" );
- player setClientDvar( "player_summary_score", "0" );
- player setClientDvar( "player_summary_challenge", "0" );
- player setClientDvar( "player_summary_match", "0" );
- player setClientDvar( "player_summary_misc", "0" );
- }
- // resetting summary vars
- player setClientDvar( "ui_opensummary", 0 );
- player maps\mp\gametypes\_missions::updateChallenges();
- player.explosiveKills[0] = 0;
- player.xpGains = [];
- player.hud_scorePopup = newClientHudElem( player );
- player.hud_scorePopup.horzAlign = "center";
- player.hud_scorePopup.vertAlign = "middle";
- player.hud_scorePopup.alignX = "center";
- player.hud_scorePopup.alignY = "middle";
- player.hud_scorePopup.x = 0;
- if ( level.splitScreen )
- player.hud_scorePopup.y = -40;
- else
- player.hud_scorePopup.y = -60;
- player.hud_scorePopup.font = "hudbig";
- player.hud_scorePopup.fontscale = 0.75;
- player.hud_scorePopup.archived = false;
- player.hud_scorePopup.color = (0.5,0.5,0.5);
- player.hud_scorePopup.sort = 10000;
- player.hud_scorePopup maps\mp\gametypes\_hud::fontPulseInit( 3.0 );
- player thread doConnect();
- player thread onPlayerSpawned();
- player thread onJoinedTeam();
- player thread onJoinedSpectators();
- }
- }
- onJoinedTeam()
- {
- self endon("disconnect");
- for(;;)
- {
- self waittill( "joined_team" );
- self thread removeRankHUD();
- }
- }
- onJoinedSpectators()
- {
- self endon("disconnect");
- for(;;)
- {
- self waittill( "joined_spectators" );
- self thread removeRankHUD();
- }
- }
- onPlayerSpawned()
- {
- self endon("disconnect");
- for(;;)
- {
- self waittill("spawned_player");
- self thread doStart();
- }
- }
- roundUp( floatVal )
- {
- if ( int( floatVal ) != floatVal )
- return int( floatVal+1 );
- else
- return int( floatVal );
- }
- giveRankXP( type, value )
- {
- self endon("disconnect");
- lootType = "none";
- if ( !self rankingEnabled() )
- return;
- if ( level.teamBased && (!level.teamCount["allies"] || !level.teamCount["axis"]) )
- return;
- else if ( !level.teamBased && (level.teamCount["allies"] + level.teamCount["axis"] < 2) )
- return;
- if ( !isDefined( value ) )
- value = getScoreInfoValue( type );
- if ( !isDefined( self.xpGains[type] ) )
- self.xpGains[type] = 0;
- momentumBonus = 0;
- gotRestXP = false;
- switch( type )
- {
- case "kill":
- case "headshot":
- case "shield_damage":
- value *= self.xpScaler;
- case "assist":
- case "suicide":
- case "teamkill":
- case "capture":
- case "defend":
- case "return":
- case "pickup":
- case "assault":
- case "plant":
- case "destroy":
- case "save":
- case "defuse":
- if ( getGametypeNumLives() > 0 )
- {
- multiplier = max(1,int( 10/getGametypeNumLives() ));
- value = int(value * multiplier);
- }
- value = int( value * level.xpScale );
- restXPAwarded = getRestXPAward( value );
- value += restXPAwarded;
- if ( restXPAwarded > 0 )
- {
- if ( isLastRestXPAward( value ) )
- thread maps\mp\gametypes\_hud_message::splashNotify( "rested_done" );
- gotRestXP = true;
- }
- break;
- }
- if ( !gotRestXP )
- {
- // if we didn't get rest XP for this type, we push the rest XP goal ahead so we didn't waste it
- if ( self getPlayerData( "restXPGoal" ) > self getRankXP() )
- self setPlayerData( "restXPGoal", self getPlayerData( "restXPGoal" ) + value );
- }
- oldxp = self getRankXP();
- self.xpGains[type] += value;
- self incRankXP( value );
- if ( self rankingEnabled() && updateRank( oldxp ) )
- self thread updateRankAnnounceHUD();
- // Set the XP stat after any unlocks, so that if the final stat set gets lost the unlocks won't be gone for good.
- self syncXPStat();
- if ( !level.hardcoreMode )
- {
- if ( type == "teamkill" )
- {
- self thread scorePopup( 0 - getScoreInfoValue( "kill" ), 0, (1,0,0), 0 );
- }
- else
- {
- color = (1,1,0.5);
- if ( gotRestXP )
- color = (1,.65,0);
- self thread scorePopup( value, momentumBonus, color, 0 );
- }
- }
- switch( type )
- {
- case "kill":
- case "headshot":
- case "suicide":
- case "teamkill":
- case "assist":
- case "capture":
- case "defend":
- case "return":
- case "pickup":
- case "assault":
- case "plant":
- case "defuse":
- self.pers["summary"]["score"] += value;
- self.pers["summary"]["xp"] += value;
- break;
- case "win":
- case "loss":
- case "tie":
- self.pers["summary"]["match"] += value;
- self.pers["summary"]["xp"] += value;
- break;
- case "challenge":
- self.pers["summary"]["challenge"] += value;
- self.pers["summary"]["xp"] += value;
- break;
- default:
- self.pers["summary"]["misc"] += value; //keeps track of ungrouped match xp reward
- self.pers["summary"]["match"] += value;
- self.pers["summary"]["xp"] += value;
- break;
- }
- }
- /*EDITED HERE*/
- updateRank( oldxp )
- {
- newRankId = self getRank();
- if ( newRankId == self.pers["rank"] )
- return false;
- oldRank = self.pers["rank"];
- rankId = self.pers["rank"];
- self.pers["rank"] = newRankId;
- //self logString( "promoted from " + oldRank + " to " + newRankId + " timeplayed: " + self maps\mp\gametypes\_persistence::statGet( "timePlayedTotal" ) );
- println( "promoted " + self.name + " from rank " + oldRank + " to " + newRankId + ". Experience went from " + oldxp + " to " + self getRankXP() + "." );
- //self setRank( newRankId );
- self setRank(70);
- return true;
- }
- updateRankAnnounceHUD()
- {
- self endon("disconnect");
- self notify("update_rank");
- self endon("update_rank");
- team = self.pers["team"];
- if ( !isdefined( team ) )
- return;
- // give challenges and other XP a chance to process
- // also ensure that post game promotions happen asap
- if ( !levelFlag( "game_over" ) )
- level waittill_notify_or_timeout( "game_over", 0.25 );
- newRankName = self getRankInfoFull( self.pers["rank"] );
- rank_char = level.rankTable[self.pers["rank"]][1];
- subRank = int(rank_char[rank_char.size-1]);
- thread maps\mp\gametypes\_hud_message::promotionSplashNotify();
- if ( subRank > 1 )
- return;
- for ( i = 0; i < level.players.size; i++ )
- {
- player = level.players[i];
- playerteam = player.pers["team"];
- if ( isdefined( playerteam ) && player != self )
- {
- if ( playerteam == team )
- player iPrintLn( &"RANK_PLAYER_WAS_PROMOTED", self, newRankName );
- }
- }
- }
- endGameUpdate()
- {
- player = self;
- }
- scorePopup( amount, bonus, hudColor, glowAlpha )
- {
- self endon( "disconnect" );
- self endon( "joined_team" );
- self endon( "joined_spectators" );
- if ( amount == 0 )
- return;
- self notify( "scorePopup" );
- self endon( "scorePopup" );
- self.xpUpdateTotal += amount;
- self.bonusUpdateTotal += bonus;
- wait ( 0.05 );
- if ( self.xpUpdateTotal < 0 )
- self.hud_scorePopup.label = &"";
- else
- self.hud_scorePopup.label = &"MP_PLUS";
- self.hud_scorePopup.color = hudColor;
- self.hud_scorePopup.glowColor = hudColor;
- self.hud_scorePopup.glowAlpha = glowAlpha;
- self.hud_scorePopup setValue(self.xpUpdateTotal);
- self.hud_scorePopup.alpha = 0.85;
- self.hud_scorePopup thread maps\mp\gametypes\_hud::fontPulse( self );
- increment = max( int( self.bonusUpdateTotal / 20 ), 1 );
- if ( self.bonusUpdateTotal )
- {
- while ( self.bonusUpdateTotal > 0 )
- {
- self.xpUpdateTotal += min( self.bonusUpdateTotal, increment );
- self.bonusUpdateTotal -= min( self.bonusUpdateTotal, increment );
- self.hud_scorePopup setValue( self.xpUpdateTotal );
- wait ( 0.05 );
- }
- }
- else
- {
- wait ( 1.0 );
- }
- self.hud_scorePopup fadeOverTime( 0.75 );
- self.hud_scorePopup.alpha = 0;
- self.xpUpdateTotal = 0;
- }
- removeRankHUD()
- {
- self.hud_scorePopup.alpha = 0;
- }
- getRank()
- {
- rankXp = self.pers["rankxp"];
- rankId = self.pers["rank"];
- if ( rankXp < (getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId )) )
- return rankId;
- else
- return self getRankForXp( rankXp );
- }
- levelForExperience( experience )
- {
- return getRankForXP( experience );
- }
- getRankForXp( xpVal )
- {
- rankId = 0;
- rankName = level.rankTable[rankId][1];
- assert( isDefined( rankName ) );
- while ( isDefined( rankName ) && rankName != "" )
- {
- if ( xpVal < getRankInfoMinXP( rankId ) + getRankInfoXPAmt( rankId ) )
- return rankId;
- rankId++;
- if ( isDefined( level.rankTable[rankId] ) )
- rankName = level.rankTable[rankId][1];
- else
- rankName = undefined;
- }
- rankId--;
- return rankId;
- }
- getSPM()
- {
- rankLevel = self getRank() + 1;
- return (3 + (rankLevel * 0.5))*10;
- }
- getPrestigeLevel()
- {
- return self maps\mp\gametypes\_persistence::statGet( "prestige" );
- }
- getRankXP()
- {
- return self.pers["rankxp"];
- }
- incRankXP( amount )
- {
- if ( !self rankingEnabled() )
- return;
- if ( isDefined( self.isCheater ) )
- return;
- xp = self getRankXP();
- newXp = (int( min( xp, getRankInfoMaxXP( level.maxRank ) ) ) + amount);
- if ( self.pers["rank"] == level.maxRank && newXp >= getRankInfoMaxXP( level.maxRank ) )
- newXp = getRankInfoMaxXP( level.maxRank );
- self.pers["rankxp"] = newXp;
- }
- getRestXPAward( baseXP )
- {
- if ( !getdvarint( "scr_restxp_enable" ) )
- return 0;
- restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
- wantGiveRestXP = int(baseXP * restXPAwardRate);
- mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
- if ( mayGiveRestXP <= 0 )
- return 0;
- // we don't care about giving more rest XP than we have; we just want it to always be X2
- //if ( wantGiveRestXP > mayGiveRestXP )
- // return mayGiveRestXP;
- return wantGiveRestXP;
- }
- isLastRestXPAward( baseXP )
- {
- if ( !getdvarint( "scr_restxp_enable" ) )
- return false;
- restXPAwardRate = getDvarFloat( "scr_restxp_restedAwardScale" ); // as a fraction of base xp
- wantGiveRestXP = int(baseXP * restXPAwardRate);
- mayGiveRestXP = self getPlayerData( "restXPGoal" ) - self getRankXP();
- if ( mayGiveRestXP <= 0 )
- return false;
- if ( wantGiveRestXP >= mayGiveRestXP )
- return true;
- return false;
- }
- syncXPStat()
- {
- xp = self getRankXP();
- self maps\mp\gametypes\_persistence::statSet( "experience", xp );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement