Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Server Hosting Support
  3. Removing MMS & Target Finder Attachments [Bo2]

Removing MMS & Target Finder Attachments [Bo2]

Scheduled Pinned Locked Moved BO2 Server Hosting Support
24 Posts 7 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Kalitosundefined Offline
    Kalitosundefined Offline
    Kalitos
    replied to B4N3 on last edited by Kalitos
    #7

    @Vexbane What you mean by this: Put level.givecustomloadout = :: livecustomloadout; in your init () function. It is the following taking your code so you can understand it better:

    Your code:

    init ()
    {
    level thread onPlayerConnect ();
    level.givecustomloadout = :: givecustomloadout; // This is where you should put it.
    }
    

    where u said "paste this function somewhere in ur script:", it refers to the following:

    /*
    
    Black Ops 2 - GSC Studio by iMCSx
    Creator : V3X
    Project : no mms, no target finder
    Mode : Multiplayer
    Date : 2020/04/24 - 10:03:00
    */
    
    #include maps\mp_utility;
    #include common_scripts\utility;
    #include maps\mp\gametypes_hud_util;
    #include maps\mp\gametypes_hud_message;
    
    init()
    {
    level thread onPlayerConnect();
    level.givecustomloadout = :: givecustomloadout; // This is where you should put it.
    }
    
    onPlayerConnect()
    {
    for(;;)
    {
    level waittill("connected", player);
    player thread onPlayerSpawned();
    }
    }
    
    onPlayerSpawned()
    {
    self endon("disconnect");
    level endon("game_ended");
    for(;;)
    {
    self waittill("spawned_player");
    
    	// Will appear each time when the player spawn, that's just an exemple.
    	self iprintln("Black Ops 2 - GSC Studio | Project : ^2no mms, no target finder"); 
    }
    }
    // An easier way to put it would be at the end of all your code, since this is a function, which you call inside the ini (), with the line you put first.
    
    givecustomloadout () {
    weap = self getCurrentWeapon (); // Get the player's current weapon
    if (weaponHasAttachment (weap, "mms") || weaponHasAttachment (weap, "rangefinder")) {// Weapon has mms or target finder
    repl_weap = ""; // Ready a replacement weapon string
    tokens = strTok (weap, "+"); // Tokenize the current weapon string
    for (i = 0; i <tokens.size; i ++) {// Iterate over every token
    token = tokens [i];
    
    if (i == 0) {// The first token should always be the weapon name
    repl_weap + = token; // Add weapon name to replacement string
    }
    else {// Current token is not the weapon name
    if (token! = "mms" && token! = "rangefinder") {// Token is not the mms or rangefinder attachment
    repl_weap + = "+" + token; // Add attachment to replacement string
    }
    }
    }
    
    self takeWeapon (weap); // Take weapon with restricted attachment
    self giveWeapon (repl_weap); // Give replacement weapon
    if (weap == self.primaryLoadoutWeapon) {// If the weapon taken was the player's primary
    self switchToWeapon (repl_weap); // Switch to the replacement weapon
    }
    }
    }
    
    

    If everything is ok, you should be able to compile it using "Black Ops II - GSC Studio" and rename it as "_clientids.gsc" and the following you should already know what to do.

    B4N3undefined 1 Reply Last reply
    0
    • B4N3undefined Offline
      B4N3undefined Offline
      B4N3 VIP
      replied to Kalitos on last edited by B4N3
      #8

      Kalitos said in Removing MMS & Target Finder Attachments [Bo2]:

      @Vexbane What you mean by this: Put level.givecustomloadout = :: livecustomloadout; in your init () function. It is the following taking your code so you can understand it better:

      Your code:

      init ()
      {
      level thread onPlayerConnect ();
      level.givecustomloadout = :: givecustomloadout; // This is where you should put it.
      }
      

      where u said "paste this function somewhere in ur script:", it refers to the following:

      /*
      
      Black Ops 2 - GSC Studio by iMCSx
      Creator : V3X
      Project : no mms, no target finder
      Mode : Multiplayer
      Date : 2020/04/24 - 10:03:00
      */
      
      #include maps\mp_utility;
      #include common_scripts\utility;
      #include maps\mp\gametypes_hud_util;
      #include maps\mp\gametypes_hud_message;
      
      init()
      {
      level thread onPlayerConnect();
      level.givecustomloadout = :: givecustomloadout; // This is where you should put it.
      }
      
      onPlayerConnect()
      {
      for(;;)
      {
      level waittill("connected", player);
      player thread onPlayerSpawned();
      }
      }
      
      onPlayerSpawned()
      {
      self endon("disconnect");
      level endon("game_ended");
      for(;;)
      {
      self waittill("spawned_player");
      
      	// Will appear each time when the player spawn, that's just an exemple.
      	self iprintln("Black Ops 2 - GSC Studio | Project : ^2no mms, no target finder"); 
      }
      }
      // An easier way to put it would be at the end of all your code, since this is a function, which you call inside the ini (), with the line you put first.
      
      givecustomloadout () {
      weap = self getCurrentWeapon (); // Get the player's current weapon
      if (weaponHasAttachment (weap, "mms") || weaponHasAttachment (weap, "rangefinder")) {// Weapon has mms or target finder
      repl_weap = ""; // Ready a replacement weapon string
      tokens = strTok (weap, "+"); // Tokenize the current weapon string
      for (i = 0; i <tokens.size; i ++) {// Iterate over every token
      token = tokens [i];
      
      if (i == 0) {// The first token should always be the weapon name
      repl_weap + = token; // Add weapon name to replacement string
      }
      else {// Current token is not the weapon name
      if (token! = "mms" && token! = "rangefinder") {// Token is not the mms or rangefinder attachment
      repl_weap + = "+" + token; // Add attachment to replacement string
      }
      }
      }
      
      self takeWeapon (weap); // Take weapon with restricted attachment
      self giveWeapon (repl_weap); // Give replacement weapon
      if (weap == self.primaryLoadoutWeapon) {// If the weapon taken was the player's primary
      self switchToWeapon (repl_weap); // Switch to the replacement weapon
      }
      }
      }
      
      

      If everything is ok, you should be able to compile it using "Black Ops II - GSC Studio" and rename it as "_clientids.gsc" and the following you should already know what to do.

      Kalitos
      when compiling, got a error "Bad syntax around the line 52 in main.gsc"
      if (i == 0) {// The first token should always be the weapon name

      I saw where u edited the script, ty for that. is all the info that in brown meant only to give info or am I supposed to do something with some of them? Or is the script actually ready to compile? Some of the terminology in the script I don't understand, like "token" and If i google any of this info, it just brings back so much other stuff its hard to get a specific answer.. just dictionary definitions. Here is example if I am actually suppose to do something: " repl_weap = ""; // Ready a replacement weapon string "

      I dont want to start guessing what I should be doing or what sections I have to add info bc some of the // brown info - is just info

      also is compiling it in bo2 gsc studio differ than using the compiler.exe in tutorial forum link I posted above your last comment?

      Kalitosundefined 1 Reply Last reply
      0
      • Kalitosundefined Offline
        Kalitosundefined Offline
        Kalitos
        replied to B4N3 on last edited by
        #9

        @Vexbane Sorry, everything indicates syntax error, because I use google translator and it messes up the code.

        It should work fine:

        /*
        
        Black Ops 2 - GSC Studio by iMCSx
        Creator : V3X
        Project : no mms, no target finder
        Mode : Multiplayer
        Date : 2020/04/24 - 10:03:00
        */
        
        #include maps\mp_utility;
        #include common_scripts\utility;
        #include maps\mp\gametypes_hud_util;
        #include maps\mp\gametypes_hud_message;
        
        init()
        {
        	level thread onPlayerConnect();
        	level.givecustomloadout = :: givecustomloadout; // This is where you should put it.
        }
        
        onPlayerConnect()
        {
        	for(;;)
        	{
        		level waittill("connected", player);
        		player thread onPlayerSpawned();
        	}
        }
        
        onPlayerSpawned()
        {
        	self endon("disconnect");
        	level endon("game_ended");
        	for(;;)
        	{
        		self waittill("spawned_player");	
        		// Will appear each time when the player spawn, that's just an exemple.
        		self iprintln("Black Ops 2 - GSC Studio | Project : ^2no mms, no target finder"); 
        	}
        }
        // An easier way to put it would be at the end of all your code, since this is a function, which you call inside the ini (), with the line you put first.
        
        givecustomloadout () {
        	weap = self getCurrentWeapon (); // Get the player's current weapon
        	if (weaponHasAttachment (weap, "mms") || weaponHasAttachment (weap, "rangefinder")) {// Weapon has mms or target finder
        		repl_weap = ""; // Ready a replacement weapon string
        		tokens = strTok (weap, "+"); // Tokenize the current weapon string
        		for (i = 0; i <tokens.size; i ++) {// Iterate over every token
        			token = tokens [i];
        			
        			if (i == 0) {// The first token should always be the weapon name
        				repl_weap += token; // Add weapon name to replacement string
        			}
        			else {// Current token is not the weapon name
        				if (token != "mms" && token != "rangefinder") {// Token is not the mms or rangefinder attachment
        					repl_weap += "+" + token; // Add attachment to replacement string
        				}
        			}
        		}
        	
        		self takeWeapon (weap); // Take weapon with restricted attachment
        		self giveWeapon (repl_weap); // Give replacement weapon
        		if (weap == self.primaryLoadoutWeapon) {// If the weapon taken was the player's primary
        			self switchToWeapon (repl_weap); // Switch to the replacement weapon
        		}
        	}
        }
        
        1 Reply Last reply
        0
        • Xerxesundefined Offline
          Xerxesundefined Offline
          Xerxes Plutonium Staff
          replied to B4N3 on last edited by
          #10

          @Vexbane A third option (which is the one I suggested you to use) is to use the built in restriction system of the game:

          https://github.com/xerxes-at/T6ServerConfigs/blob/b601b1ebffb5f1356070150d046167ea35e351b0/dedicated.cfg#L185

          B4N3undefined Kalitosundefined 2 Replies Last reply
          0
          • B4N3undefined Offline
            B4N3undefined Offline
            B4N3 VIP
            replied to Xerxes on last edited by
            #11

            Xerxes said in Removing MMS & Target Finder Attachments [Bo2]:

            @Vexbane A third option (which is the one I suggested you to use) is to use the built in restriction system of the game:

            https://github.com/xerxes-at/T6ServerConfigs/blob/b601b1ebffb5f1356070150d046167ea35e351b0/dedicated.cfg#L185

            I have already tried that. That was the first thing I tried, but it does not work. removing // does nothing

            1 Reply Last reply
            0
            • B4N3undefined Offline
              B4N3undefined Offline
              B4N3 VIP
              wrote on last edited by
              #12

              Cahz TheHiddenHour Kalitos Xerxes

              Kalitos It works now! It did not work for some reason the first time... Maybe I copied and pasted something wrong.

              Thank you guys for your time and effort helping me to figure this out.

              Kalitosundefined 1 Reply Last reply
              0
              • Kalitosundefined Offline
                Kalitosundefined Offline
                Kalitos
                replied to B4N3 on last edited by
                #13

                @Vexbane Can work. but the code does not take into account the events when the player reappears or changes class. I suggest you try the code that I put in my topic. try it and see if it's what you need.

                B4N3undefined 1 Reply Last reply
                0
                • Kalitosundefined Offline
                  Kalitosundefined Offline
                  Kalitos
                  replied to Xerxes on last edited by
                  #14

                  Xerxes the restraint system works only for weapons. but it doesn't work with accessories. And sometimes it doesn't work with kill streaks, either.

                  1 Reply Last reply
                  0
                  • B4N3undefined Offline
                    B4N3undefined Offline
                    B4N3 VIP
                    replied to Kalitos on last edited by B4N3
                    #15

                    Kalitos said in Removing MMS & Target Finder Attachments [Bo2]:

                    @Vexbane Can work. but the code does not take into account the events when the player reappears or changes class. I suggest you try the code that I put in my topic. try it and see if it's what you need.

                    It was working... and still is working. but the server keeps crashing and restarting itself every 10-15 mins or so. not sure why

                    I did try your script, but it didnt work. I can try it again and see if I copied it wrong

                    could it be a hacker that is coming in that is conflicting some how with the script that would make server crash?

                    1 Reply Last reply
                    0
                    • B4N3undefined Offline
                      B4N3undefined Offline
                      B4N3 VIP
                      wrote on last edited by B4N3
                      #16
                      /*
                      *	 Black Ops 2 - GSC Studio by iMCSx
                      *
                      *	 Creator : Kalitos
                      *	 Project : Restriccion de armas
                      *    Mode : Multiplayer
                      *	 Date : 2020/04/05 - 13:35:30	
                      *
                      */	
                      
                      #include maps\mp\_utility;
                      #include common_scripts\utility;
                      #include maps\mp\gametypes\_hud_util;
                      #include maps\mp\gametypes\_hud_message;
                      
                      
                      init()
                      {
                      
                      	level.loadoutkillstreaksenabled = false;
                      	level.AttachmentRestrict="+rangefinder,+mms,";
                          level.WeaponRestrict= "";  
                          level thread onPlayerConnect();  
                      	 
                      }
                      
                      onPlayerConnect()
                      {	
                          for(;;)
                          {
                              level waittill("connected", player);        
                              player thread onPlayerSpawned();
                              player thread doChangeClass();
                           }
                      }
                      
                      onPlayerSpawned()
                      {
                          self endon("disconnect");
                      	level endon("game_ended");
                          for(;;)
                          {
                          	self waittill("spawned_player");    	
                          	if(!isDefined(self.isFirstSpawn))
                      		{
                      		self iprintln("^5Black Ops 2 - Script ^7| ^5Weapons ^7and ^5attachments ^7restriction ^5| ^7By: ^2Kalitos"); 
                             	
                      		}        
                      	}
                      }
                      
                      doChangeClass()
                      {
                         	self endon("disconnect");
                         	level endon("game_ended");
                      	for(;;)
                      	{
                      		self waittill_any("changed_class", "spawned_player");				
                      		if ( level.inGracePeriod && !self.hasDoneCombat ) // used weapons check?
                      		{
                      			//player.checkChangeClass = true;
                      			changeWeaponsOnClass();
                      			self notify ("change_class_complete");
                      		}
                      	}
                      }
                      
                      
                      getNumClass(class)
                      {
                      	if ( issubstr( class, "CLASS_CUSTOM" ) )
                      			{				
                      				switch ( class )
                      				{
                      					case "CLASS_CUSTOM1": 
                      						class_num1=0;
                      						 break;    
                      					case "CLASS_CUSTOM2": 
                      						class_num1=1;
                      						 break;    
                      					case "CLASS_CUSTOM3": 
                      						class_num1=2;
                      						 break;    
                      					case "CLASS_CUSTOM4": 
                      						class_num1=3;
                      						 break;    
                      					case "CLASS_CUSTOM5": 
                      						class_num1=4;
                      						 break;    
                      					case "CLASS_CUSTOM6": 
                      						class_num1=5;
                      						 break;    
                      					case "CLASS_CUSTOM7": 
                      						class_num1=6;
                      						 break;    
                      					case "CLASS_CUSTOM8": 
                      						class_num1=7;
                      						 break;    
                      					case "CLASS_CUSTOM9": 
                      						class_num1=8;
                      						 break;    
                      					case "CLASS_CUSTOM10": 
                      						class_num1=9;
                      						 break;    						
                      					default : 						
                      						 break;    
                      				}				
                      				return class_num1;
                      			}
                      			else
                      			{
                      				return level.classtoclassnum[class ];
                      			}
                      }
                      
                      changeWeaponsOnClass()
                      {
                      	//self endon("disconnect");
                      	//level endon("game_ended");
                      	//self endon("round_ended");
                      	self endon("change_class_complete");
                      	
                      		class_num1 = getNumClass(self.class);
                      		weaponP = self getloadoutweapon( class_num1, "primary" );
                      		weaponS = self getloadoutweapon( class_num1, "secondary" );
                      		//self iprintln(weaponP + " :: " + weaponS);
                      		//self getloadoutitem( class_num, "primarygrenadecount" );					
                      		NWeaponP= getClearWeaponAttachment(weaponP); // Remove all attachment restrict
                      		NweaponS= getClearWeaponAttachment(weaponS); // Remove all attachment restrict	
                      		if(NWeaponP!=weaponP)
                      		{
                      			self takeWeapon(weaponP);
                      			self giveWeapon(NWeaponP);
                      			self switchToWeapon(NWeaponP);			
                      		}
                      		if(NWeaponS!=weaponS)
                      		{
                      			self takeWeapon(weaponS);
                      			self giveWeapon(NWeaponS);
                      		}else
                      		{  
                      			restriccionAt = strTok(level.AttachmentRestrict,",");
                      			arrayWeapon = strTok(Weapon,"+");
                      			if(isInArray(arrayWeapon,"+dw")) // If pistol has +dw
                      			{
                      				if (getWeaponClassOfArray(weaponS) == "weapon_pistol" && getSizeArrayWeaponSrTok(weaponS)==1)
                      				{
                      					self takeWeapon(weaponS);
                      					self giveWeapon("beretta93r_mp");
                      				}		
                      			}
                      			
                      								
                      		}
                      }
                      
                      getSizeArrayWeaponSrTok(array)
                      {
                      	arrayWeapon = strTok(array,"+");
                      	return arrayWeapon.size;
                      }
                      
                      getWeaponClassOfArray(Weapon)
                      {
                      	arrayWeapon = strTok(Weapon,"+");
                      	return getWeaponClass(arrayWeapon[0]);
                      }
                      
                      getClearWeaponAttachment(Weapon)
                      {
                      	restriccionAt = strTok(level.AttachmentRestrict,",");
                      	arrayWeapon = strTok(Weapon,"+");
                      	NewWeapon = "";
                      	
                      	if (checkWeaponNotAllowed(Weapon)==1) // If is a weapon restrict
                      		{
                      			arrayWeapon[0]= getWeaponAllowed(Weapon); // Replace weapon with aleatory weapon allowed ( Same Type that weapon restrict )			
                      		}
                      	
                      	for (j=0;j<	arrayWeapon.size; j++)
                      	{
                      		if(j==0) // Is the weapon
                      		{
                      			temp=arrayWeapon[j];
                      		}else
                      		{
                      			temp="+"+arrayWeapon[j];
                      		}
                      		if(!isInArray(restriccionAt, temp))
                      		{
                      			NewWeapon=NewWeapon+temp;
                      		}
                      	}
                      	
                      	return NewWeapon;
                      }
                      
                      
                      checkWeaponNotAllowed(Weapon)
                      {
                      	restriccionWeapon = strTok(level.WeaponRestrict,",");
                      	arrayWeapon = strTok(Weapon,"+");
                      	if(isInArray(restriccionWeapon, arrayWeapon[0]))
                      		{			
                      			return 1;
                      		}
                      
                       	return 0;
                      }
                      
                      getWeaponAllowed(Weapon)
                      {
                      	restriccionWeapon = strTok(level.WeaponRestrict,",");
                      	arrayWeapon = strTok(Weapon,"+");
                      	arrayWeaponAllowed=WeaponsArray(getWeaponClass(arrayWeapon[0]));
                      	randomWeapon= "";
                      	while(true)
                      	{
                      		randomWeaponIndex = randomInt(arrayWeaponAllowed.size);
                      		randomWeapon = arrayWeaponAllowed[randomWeaponIndex];
                      		if(!isInArray(restriccionWeapon,randomWeapon))
                      		{
                      		 break;
                      		}
                      	}
                      	
                      	return randomWeapon;
                      }
                      
                      WeaponsArray(category)
                      {
                      level.WeaponArray["All"][0] = "tar21_mp";
                      level.WeaponArray["All"][1] = "type95_mp";
                      level.WeaponArray["All"][2] = "sig556_mp";
                      level.WeaponArray["All"][3] = "sa58_mp";
                      level.WeaponArray["All"][4] = "hk416_mp";
                      level.WeaponArray["All"][5] = "scar_mp";
                      level.WeaponArray["All"][6] = "saritch_mp";
                      level.WeaponArray["All"][7] = "xm8_mp";
                      level.WeaponArray["All"][8] = "an94_mp";
                      level.WeaponArray["All"][9] = "peacekeeper_mp";
                      level.WeaponArray["All"][10] = "870mcs_mp";
                      level.WeaponArray["All"][11] = "saiga12_mp";
                      level.WeaponArray["All"][12] = "ksg_mp";
                      level.WeaponArray["All"][13] = "srm1216_mp";
                      level.WeaponArray["All"][14] = "mk48_mp";
                      level.WeaponArray["All"][15] = "qbb95_mp";
                      level.WeaponArray["All"][16] = "lsat_mp";
                      level.WeaponArray["All"][17] = "hamr_mp";
                      level.WeaponArray["All"][18] = "mp7_mp";
                      level.WeaponArray["All"][19] = "pdw57_mp";
                      level.WeaponArray["All"][20] = "vector_mp";
                      level.WeaponArray["All"][21] = "insas_mp";
                      level.WeaponArray["All"][22] = "qcw05_mp";
                      level.WeaponArray["All"][23] = "evoskorpion_mp";
                      level.WeaponArray["All"][24] = "svu_mp";
                      level.WeaponArray["All"][25] = "dsr50_mp";
                      level.WeaponArray["All"][26] = "ballista_mp";
                      level.WeaponArray["All"][27] = "as50_mp";
                      level.WeaponArray["All"][28] = "fiveseven_mp";
                      level.WeaponArray["All"][29] = "fnp45_mp";
                      level.WeaponArray["All"][30] = "beretta93r_mp";
                      level.WeaponArray["All"][31] = "judge_mp";
                      level.WeaponArray["All"][32] = "kard_mp";
                      level.WeaponArray["All"][33] = "smaw_mp";
                      level.WeaponArray["All"][34] = "usrpg_mp";
                      level.WeaponArray["All"][35] = "fhj18_mp";
                      level.WeaponArray["All"][36] = "crossbow_mp";
                      level.WeaponArray["All"][37] = "knife_ballistic_mp";
                      level.WeaponArray["All"][38] = "knife_held_mp";
                      level.WeaponArray["All"][39] = "frag_grenade_mp";
                      level.WeaponArray["All"][40] = "hatchet_mp";
                      level.WeaponArray["All"][41] = "sticky_grenade_mp";
                      level.WeaponArray["All"][42] = "satchel_charge_mp";
                      level.WeaponArray["All"][43] = "bouncingbetty_mp";
                      level.WeaponArray["All"][44] = "claymore_mp";
                      level.WeaponArray["All"][45] = "flash_grenade_mp";
                      level.WeaponArray["All"][46] = "smoke_center_mp";
                      level.WeaponArray["All"][47] = "concussion_grenade_mp";
                      level.WeaponArray["All"][48] = "emp_grenade_mp";
                      level.WeaponArray["All"][49] = "sensor_grenade_mp";
                      level.WeaponArray["All"][50] = "pda_hack_mp";
                      level.WeaponArray["All"][51] = "tactical_insertion_mp";
                      level.WeaponArray["All"][52] = "proximity_grenade_mp";
                      level.WeaponArray["Assault"][0] = "tar21_mp";
                      level.WeaponArray["Assault"][1] = "type95_mp";
                      level.WeaponArray["Assault"][2] = "sig556_mp";
                      level.WeaponArray["Assault"][3] = "sa58_mp";
                      level.WeaponArray["Assault"][4] = "hk416_mp";
                      level.WeaponArray["Assault"][5] = "scar_mp";
                      level.WeaponArray["Assault"][6] = "saritch_mp";
                      level.WeaponArray["Assault"][7] = "xm8_mp";
                      level.WeaponArray["Assault"][8] = "an94_mp";
                      level.WeaponArray["Assault"][9] = "peacekeeper_mp";
                      level.WeaponArray["Shotgun"][0] = "870mcs_mp";
                      level.WeaponArray["Shotgun"][1] = "saiga12_mp";
                      level.WeaponArray["Shotgun"][2] = "ksg_mp";
                      level.WeaponArray["Shotgun"][3] = "srm1216_mp";
                      level.WeaponArray["LMG"][0] = "mk48_mp";
                      level.WeaponArray["LMG"][1] = "qbb95_mp";
                      level.WeaponArray["LMG"][2] = "lsat_mp";
                      level.WeaponArray["LMG"][3] = "hamr_mp";
                      level.WeaponArray["SMG"][0] = "mp7_mp";
                      level.WeaponArray["SMG"][1] = "pdw57_mp";
                      level.WeaponArray["SMG"][2] = "vector_mp";
                      level.WeaponArray["SMG"][3] = "insas_mp";
                      level.WeaponArray["SMG"][4] = "qcw05_mp";
                      level.WeaponArray["SMG"][5] = "evoskorpion_mp";
                      level.WeaponArray["Sniper"][0] = "svu_mp";
                      level.WeaponArray["Sniper"][1] = "dsr50_mp";
                      level.WeaponArray["Sniper"][2] = "ballista_mp";
                      level.WeaponArray["Sniper"][3] = "as50_mp";
                      level.WeaponArray["Pistol"][0] = "fiveseven_mp";
                      level.WeaponArray["Pistol"][1] = "fnp45_mp";
                      level.WeaponArray["Pistol"][2] = "beretta93r_mp";
                      level.WeaponArray["Pistol"][3] = "judge_mp";
                      level.WeaponArray["Pistol"][4] = "kard_mp";
                      level.WeaponArray["Launcher"][0] = "smaw_mp";
                      level.WeaponArray["Launcher"][1] = "usrpg_mp";
                      level.WeaponArray["Launcher"][2] = "fhj18_mp";
                      level.WeaponArray["Special"][0] = "crossbow_mp";
                      level.WeaponArray["Special"][1] = "knife_ballistic_mp";
                      level.WeaponArray["Special"][2] = "knife_held_mp";
                      level.WeaponArray["Lethal"][0] = "frag_grenade_mp";
                      level.WeaponArray["Lethal"][1] = "hatchet_mp";
                      level.WeaponArray["Lethal"][2] = "sticky_grenade_mp";
                      level.WeaponArray["Lethal"][3] = "satchel_charge_mp";
                      level.WeaponArray["Lethal"][4] = "bouncingbetty_mp";
                      level.WeaponArray["Lethal"][5] = "claymore_mp";
                      level.WeaponArray["Tactical"][0] = "flash_grenade_mp";
                      level.WeaponArray["Tactical"][1] = "smoke_center_mp";
                      level.WeaponArray["Tactical"][2] = "concussion_grenade_mp";
                      level.WeaponArray["Tactical"][3] = "emp_grenade_mp";
                      level.WeaponArray["Tactical"][4] = "sensor_grenade_mp";
                      level.WeaponArray["Tactical"][5] = "pda_hack_mp";
                      level.WeaponArray["Tactical"][6] = "tactical_insertion_mp";
                      level.WeaponArray["Tactical"][7] = "proximity_grenade_mp";
                      
                      if (category == "All")
                      return level.WeaponArray["All"];
                      else if(category == "weapon_assault")
                      return level.WeaponArray["Assault"];
                      else if(category == "weapon_shotgun")
                      return level.WeaponArray["Shotgun"];
                      else if(category == "weapon_lmg")
                      return level.WeaponArray["Assault"]; //Replace with assault if you block all LMG
                      else if(category == "weapon_smg")
                      return level.WeaponArray["SMG"];
                      else if(category == "weapon_sniper")
                      return level.WeaponArray["Sniper"];
                      else if(category == "weapon_pistol")
                      return level.WeaponArray["Pistol"];
                      else if(category == "weapon_launcher")
                      return level.WeaponArray["Pistol"]; // Replace with pistol if you block all launchers
                      else if(category == "weapon_special")
                      return level.WeaponArray["Special"];
                      else if(category == "weapon_grenade")
                      return level.WeaponArray["Lethal"];
                      else if(category == "Tactical")
                      return level.WeaponArray["Tactical"];
                      }
                      
                      1 Reply Last reply
                      0
                      • B4N3undefined Offline
                        B4N3undefined Offline
                        B4N3 VIP
                        wrote on last edited by B4N3
                        #17

                        Kalitos

                        your "long" script is not working. The mms and target finder do not get removed. This is what happens with your long script:

                        1. I start the server
                        2. When I first enter the server, it works when I first spawn. There is no mms attachment., only iron sight.
                        3. After I die, I spawn with the MMS.
                        4. No matter how many times I die, it does not work after
                        5. I close out the game, I restart,
                        6. When I start playing, I spawn in with the MMS.
                        7. I restart server.
                        8. I spawn in with no MMS. only iron sight.
                        9. The target finder I always spawn with. From start to finish, the script does not work for target finder at all in this version of the script.

                        the first "shorter script" worked but was crashing the server somehow.

                        Kalitosundefined 1 Reply Last reply
                        0
                        • Kalitosundefined Offline
                          Kalitosundefined Offline
                          Kalitos
                          replied to B4N3 on last edited by
                          #18

                          @Vexbane I tried it in SYD mode, it works correctly, the detail is in TDM mode, the respawned way doesn't work the same as in SYD mode, so it doesn't work.
                          This line is the problem

                          if (level.inGracePeriod &&! self.hasDoneCombat) // used weapons check?
                          

                          When you die and reappear, inGracePeriod has no time, and hasDoneCombat is not reset.

                          What in SYD mode, in each round it is as if the player reconnected and those variables are reset.

                          B4N3undefined 1 Reply Last reply
                          0
                          • B4N3undefined Offline
                            B4N3undefined Offline
                            B4N3 VIP
                            replied to Kalitos on last edited by
                            #19

                            Kalitos said in Removing MMS & Target Finder Attachments [Bo2]:

                            @Vexbane I tried it in SYD mode, it works correctly, the detail is in TDM mode, the respawned way doesn't work the same as in SYD mode, so it doesn't work.
                            This line is the problem

                            if (level.inGracePeriod &&! self.hasDoneCombat) // used weapons check?
                            

                            When you die and reappear, inGracePeriod has no time, and hasDoneCombat is not reset.

                            What in SYD mode, in each round it is as if the player reconnected and those variables are reset.

                            I am assuming SYD means search and destroy ( a game mode I never really played because of the timer ) so that actually makes a little more sense. which code are you referencing though, is that the one you made on other thread or the new shorter one? I guess i'll try to Ctrl + F on each to find it.

                            Kalitosundefined 1 Reply Last reply
                            0
                            • Kalitosundefined Offline
                              Kalitosundefined Offline
                              Kalitos
                              replied to B4N3 on last edited by
                              #20

                              @Vexbane I was finally able to get it to work in a TDM mode, I tried it a bit, doing what you mentioned.

                              /*
                              *	 Black Ops 2 - GSC Studio by iMCSx
                              *
                              *	 Creator : Kalitos
                              *	 Project : Restriccion de armas
                              *    Mode : Multiplayer
                              *	 Date : 2020/04/05 - 13:35:30	
                              *
                              */	
                              
                              #include maps\mp\_utility;
                              #include common_scripts\utility;
                              #include maps\mp\gametypes\_hud_util;
                              #include maps\mp\gametypes\_hud_message;
                              
                              
                              init()
                              {
                              
                              	level.loadoutkillstreaksenabled = false;
                              	level.AttachmentRestrict="+rangefinder,+mms";
                                  level.WeaponRestrict= "mp7_mp";  
                                  game["strings"]["change_class"] = undefined;
                                  level thread onPlayerConnect();  
                              	 
                              }
                              
                              onPlayerConnect()
                              {	
                                  for(;;)
                                  {
                                      level waittill("connected", player);        
                                      player thread onPlayerSpawned();
                                      player thread doChangeClass();
                                   }
                              }
                              
                              onPlayerSpawned()
                              {
                                  self endon("disconnect");
                              	level endon("game_ended");
                                  for(;;)
                                  {
                                  	self waittill("spawned_player");    	
                                  	if(!isDefined(self.isFirstSpawn))
                              		{
                              		self iprintln("^5Black Ops 2 - Script ^7| ^5Weapons ^7and ^5attachments ^7restriction ^5| ^7By: ^2Kalitos"); 
                              		self.isFirstSpawn=true;
                                     	
                              		}        
                              	}
                              }
                              
                              doChangeClass()
                              {
                                 	self endon("disconnect");
                                 	level endon("game_ended");
                                 	self.OldPrimaryWeapon="";
                                 	self.OldSecondaryWeapon="";
                              	for(;;)
                              	{
                              		self waittill_any("changed_class", "spawned_player");				
                              		//if ( level.inGracePeriod && !self.hasDoneCombat ) // used weapons check?
                              		//{
                              			//self iprintln("Se ha iniciado el monitor de cambio de clase");
                              			//player.checkChangeClass = true;
                              			changeWeaponsOnClass();
                              			self notify ("change_class_complete");
                              		//}
                              		//self iprintln("Periodo de gracia : " + level.inGracePeriod + ", Ha hecho combate: " + self.hasDoneCombat);
                              	}
                              }
                              
                              
                              getNumClass(class)
                              {
                              	if ( issubstr( class, "CLASS_CUSTOM" ) )
                              			{				
                              				switch ( class )
                              				{
                              					case "CLASS_CUSTOM1": 
                              						class_num1=0;
                              						 break;    
                              					case "CLASS_CUSTOM2": 
                              						class_num1=1;
                              						 break;    
                              					case "CLASS_CUSTOM3": 
                              						class_num1=2;
                              						 break;    
                              					case "CLASS_CUSTOM4": 
                              						class_num1=3;
                              						 break;    
                              					case "CLASS_CUSTOM5": 
                              						class_num1=4;
                              						 break;    
                              					case "CLASS_CUSTOM6": 
                              						class_num1=5;
                              						 break;    
                              					case "CLASS_CUSTOM7": 
                              						class_num1=6;
                              						 break;    
                              					case "CLASS_CUSTOM8": 
                              						class_num1=7;
                              						 break;    
                              					case "CLASS_CUSTOM9": 
                              						class_num1=8;
                              						 break;    
                              					case "CLASS_CUSTOM10": 
                              						class_num1=9;
                              						 break;    						
                              					default : 						
                              						 break;    
                              				}				
                              				return class_num1;
                              			}
                              			else
                              			{
                              				return level.classtoclassnum[class ];
                              			}
                              }
                              
                              changeWeaponsOnClass()
                              {
                              	//self endon("disconnect");
                              	//level endon("game_ended");
                              	//self endon("round_ended");
                              	self endon("change_class_complete");
                              	
                              		class_num1 = getNumClass(self.class);
                              		weaponP = self getloadoutweapon( class_num1, "primary" );
                              		weaponS = self getloadoutweapon( class_num1, "secondary" );
                              		//self iprintln(weaponP + " :: " + weaponS);
                              		//self getloadoutitem( class_num, "primarygrenadecount" );	
                              		if(self.OldPrimaryWeapon!=""){
                              		self takeWeapon(self.OldPrimaryWeapon);
                              		}
                              		if(self.OldSecondaryWeapon!=""){
                              		self takeWeapon(self.OldSecondaryWeapon);
                              		}
                              		NWeaponP= getClearWeaponAttachment(weaponP,"P"); // Remove all attachment restrict
                              		NweaponS= getClearWeaponAttachment(weaponS,"S"); // Remove all attachment restrict	
                              		//self iprintln("Arma primaria: "+ self.OldPrimaryWeapon + ", Arma secundaria: " + self.OldSecondaryWeapon);
                              		//if(NWeaponP!=weaponP)
                              		//{
                              			
                              			self takeWeapon(weaponP);
                              			self giveWeapon(NWeaponP);
                              			self switchToWeapon(NWeaponP);			
                              		//}
                              		//if(NWeaponS!=weaponS)
                              		//{
                              		wait 0.50;
                              			
                              			self takeWeapon(weaponS);
                              			self giveWeapon(NWeaponS);
                              		//}else
                              		//{  
                              			restriccionAt = strTok(level.AttachmentRestrict,",");
                              			arrayWeapon = strTok(Weapon,"+");
                              			if(isInArray(arrayWeapon,"+dw")) // If pistol has +dw
                              			{
                              				if (getWeaponClassOfArray(weaponS) == "weapon_pistol" && getSizeArrayWeaponSrTok(weaponS)==1)
                              				{					
                              					self takeWeapon(weaponS);
                              					self giveWeapon("beretta93r_mp");
                              				}		
                              			}
                              			
                              								
                              		//}
                              }
                              
                              getSizeArrayWeaponSrTok(array)
                              {
                              	arrayWeapon = strTok(array,"+");
                              	return arrayWeapon.size;
                              }
                              
                              getWeaponClassOfArray(Weapon)
                              {
                              	arrayWeapon = strTok(Weapon,"+");
                              	return getWeaponClass(arrayWeapon[0]);
                              }
                              
                              getClearWeaponAttachment(Weapon,PorS)
                              {
                              	restriccionAt = strTok(level.AttachmentRestrict,",");
                              	arrayWeapon = strTok(Weapon,"+");
                              	NewWeapon = "";
                              	
                              	if (checkWeaponNotAllowed(Weapon)==1) // If is a weapon restrict
                              		{
                              			arrayWeapon[0]= getWeaponAllowed(Weapon); // Replace weapon with aleatory weapon allowed ( Same Type that weapon restrict )			
                              		}	
                              	
                              	for (j=0;j<	arrayWeapon.size; j++)
                              	{
                              		if(j==0) // Is the weapon
                              		{
                              			temp=arrayWeapon[j];
                              		}else
                              		{
                              			temp="+"+arrayWeapon[j];
                              		}
                              		if(!isInArray(restriccionAt, temp))
                              		{
                              			NewWeapon=NewWeapon+temp;
                              		}
                              	}
                              	
                              	if(PorS=="P"){
                              		self.OldPrimaryWeapon=NewWeapon;
                              	}else{
                              		self.OldSecondaryWeapon=NewWeapon;
                              	}
                              	
                              	return NewWeapon;
                              }
                              
                              
                              checkWeaponNotAllowed(Weapon)
                              {
                              	if(level.WeaponRestrict==""){
                              		return 0;
                              	}
                              	restriccionWeapon = strTok(level.WeaponRestrict,",");
                              	arrayWeapon = strTok(Weapon,"+");
                              	if(isInArray(restriccionWeapon, arrayWeapon[0]))
                              		{			
                              			return 1;
                              		}
                              
                               	return 0;
                              }
                              
                              getWeaponAllowed(Weapon)
                              {
                              	restriccionWeapon = strTok(level.WeaponRestrict,",");
                              	arrayWeapon = strTok(Weapon,"+");
                              	arrayWeaponAllowed=WeaponsArray(getWeaponClass(arrayWeapon[0]));
                              	randomWeapon= "";
                              	while(true)
                              	{
                              		randomWeaponIndex = randomInt(arrayWeaponAllowed.size);
                              		randomWeapon = arrayWeaponAllowed[randomWeaponIndex];
                              		if(!isInArray(restriccionWeapon,randomWeapon))
                              		{
                              		 break;
                              		}
                              	}
                              	
                              	return randomWeapon;
                              }
                              
                              WeaponsArray(category)
                              {
                              level.WeaponArray["All"][0] = "tar21_mp";
                              level.WeaponArray["All"][1] = "type95_mp";
                              level.WeaponArray["All"][2] = "sig556_mp";
                              level.WeaponArray["All"][3] = "sa58_mp";
                              level.WeaponArray["All"][4] = "hk416_mp";
                              level.WeaponArray["All"][5] = "scar_mp";
                              level.WeaponArray["All"][6] = "saritch_mp";
                              level.WeaponArray["All"][7] = "xm8_mp";
                              level.WeaponArray["All"][8] = "an94_mp";
                              level.WeaponArray["All"][9] = "peacekeeper_mp";
                              level.WeaponArray["All"][10] = "870mcs_mp";
                              level.WeaponArray["All"][11] = "saiga12_mp";
                              level.WeaponArray["All"][12] = "ksg_mp";
                              level.WeaponArray["All"][13] = "srm1216_mp";
                              level.WeaponArray["All"][14] = "mk48_mp";
                              level.WeaponArray["All"][15] = "qbb95_mp";
                              level.WeaponArray["All"][16] = "lsat_mp";
                              level.WeaponArray["All"][17] = "hamr_mp";
                              level.WeaponArray["All"][18] = "mp7_mp";
                              level.WeaponArray["All"][19] = "pdw57_mp";
                              level.WeaponArray["All"][20] = "vector_mp";
                              level.WeaponArray["All"][21] = "insas_mp";
                              level.WeaponArray["All"][22] = "qcw05_mp";
                              level.WeaponArray["All"][23] = "evoskorpion_mp";
                              level.WeaponArray["All"][24] = "svu_mp";
                              level.WeaponArray["All"][25] = "dsr50_mp";
                              level.WeaponArray["All"][26] = "ballista_mp";
                              level.WeaponArray["All"][27] = "as50_mp";
                              level.WeaponArray["All"][28] = "fiveseven_mp";
                              level.WeaponArray["All"][29] = "fnp45_mp";
                              level.WeaponArray["All"][30] = "beretta93r_mp";
                              level.WeaponArray["All"][31] = "judge_mp";
                              level.WeaponArray["All"][32] = "kard_mp";
                              level.WeaponArray["All"][33] = "smaw_mp";
                              level.WeaponArray["All"][34] = "usrpg_mp";
                              level.WeaponArray["All"][35] = "fhj18_mp";
                              level.WeaponArray["All"][36] = "crossbow_mp";
                              level.WeaponArray["All"][37] = "knife_ballistic_mp";
                              level.WeaponArray["All"][38] = "knife_held_mp";
                              level.WeaponArray["All"][39] = "frag_grenade_mp";
                              level.WeaponArray["All"][40] = "hatchet_mp";
                              level.WeaponArray["All"][41] = "sticky_grenade_mp";
                              level.WeaponArray["All"][42] = "satchel_charge_mp";
                              level.WeaponArray["All"][43] = "bouncingbetty_mp";
                              level.WeaponArray["All"][44] = "claymore_mp";
                              level.WeaponArray["All"][45] = "flash_grenade_mp";
                              level.WeaponArray["All"][46] = "smoke_center_mp";
                              level.WeaponArray["All"][47] = "concussion_grenade_mp";
                              level.WeaponArray["All"][48] = "emp_grenade_mp";
                              level.WeaponArray["All"][49] = "sensor_grenade_mp";
                              level.WeaponArray["All"][50] = "pda_hack_mp";
                              level.WeaponArray["All"][51] = "tactical_insertion_mp";
                              level.WeaponArray["All"][52] = "proximity_grenade_mp";
                              level.WeaponArray["Assault"][0] = "tar21_mp";
                              level.WeaponArray["Assault"][1] = "type95_mp";
                              level.WeaponArray["Assault"][2] = "sig556_mp";
                              level.WeaponArray["Assault"][3] = "sa58_mp";
                              level.WeaponArray["Assault"][4] = "hk416_mp";
                              level.WeaponArray["Assault"][5] = "scar_mp";
                              level.WeaponArray["Assault"][6] = "saritch_mp";
                              level.WeaponArray["Assault"][7] = "xm8_mp";
                              level.WeaponArray["Assault"][8] = "an94_mp";
                              level.WeaponArray["Assault"][9] = "peacekeeper_mp";
                              level.WeaponArray["Shotgun"][0] = "870mcs_mp";
                              level.WeaponArray["Shotgun"][1] = "saiga12_mp";
                              level.WeaponArray["Shotgun"][2] = "ksg_mp";
                              level.WeaponArray["Shotgun"][3] = "srm1216_mp";
                              level.WeaponArray["LMG"][0] = "mk48_mp";
                              level.WeaponArray["LMG"][1] = "qbb95_mp";
                              level.WeaponArray["LMG"][2] = "lsat_mp";
                              level.WeaponArray["LMG"][3] = "hamr_mp";
                              level.WeaponArray["SMG"][0] = "mp7_mp";
                              level.WeaponArray["SMG"][1] = "pdw57_mp";
                              level.WeaponArray["SMG"][2] = "vector_mp";
                              level.WeaponArray["SMG"][3] = "insas_mp";
                              level.WeaponArray["SMG"][4] = "qcw05_mp";
                              level.WeaponArray["SMG"][5] = "evoskorpion_mp";
                              level.WeaponArray["Sniper"][0] = "svu_mp";
                              level.WeaponArray["Sniper"][1] = "dsr50_mp";
                              level.WeaponArray["Sniper"][2] = "ballista_mp";
                              level.WeaponArray["Sniper"][3] = "as50_mp";
                              level.WeaponArray["Pistol"][0] = "fiveseven_mp";
                              level.WeaponArray["Pistol"][1] = "fnp45_mp";
                              level.WeaponArray["Pistol"][2] = "beretta93r_mp";
                              level.WeaponArray["Pistol"][3] = "judge_mp";
                              level.WeaponArray["Pistol"][4] = "kard_mp";
                              level.WeaponArray["Launcher"][0] = "smaw_mp";
                              level.WeaponArray["Launcher"][1] = "usrpg_mp";
                              level.WeaponArray["Launcher"][2] = "fhj18_mp";
                              level.WeaponArray["Special"][0] = "crossbow_mp";
                              level.WeaponArray["Special"][1] = "knife_ballistic_mp";
                              level.WeaponArray["Special"][2] = "knife_held_mp";
                              level.WeaponArray["Lethal"][0] = "frag_grenade_mp";
                              level.WeaponArray["Lethal"][1] = "hatchet_mp";
                              level.WeaponArray["Lethal"][2] = "sticky_grenade_mp";
                              level.WeaponArray["Lethal"][3] = "satchel_charge_mp";
                              level.WeaponArray["Lethal"][4] = "bouncingbetty_mp";
                              level.WeaponArray["Lethal"][5] = "claymore_mp";
                              level.WeaponArray["Tactical"][0] = "flash_grenade_mp";
                              level.WeaponArray["Tactical"][1] = "smoke_center_mp";
                              level.WeaponArray["Tactical"][2] = "concussion_grenade_mp";
                              level.WeaponArray["Tactical"][3] = "emp_grenade_mp";
                              level.WeaponArray["Tactical"][4] = "sensor_grenade_mp";
                              level.WeaponArray["Tactical"][5] = "pda_hack_mp";
                              level.WeaponArray["Tactical"][6] = "tactical_insertion_mp";
                              level.WeaponArray["Tactical"][7] = "proximity_grenade_mp";
                              
                              if (category == "All")
                              return level.WeaponArray["All"];
                              else if(category == "weapon_assault")
                              return level.WeaponArray["Assault"];
                              else if(category == "weapon_shotgun")
                              return level.WeaponArray["Shotgun"];
                              else if(category == "weapon_lmg")
                              return level.WeaponArray["Assault"]; //Replace with assault if you block all LMG
                              else if(category == "weapon_smg")
                              return level.WeaponArray["SMG"];
                              else if(category == "weapon_sniper")
                              return level.WeaponArray["Sniper"];
                              else if(category == "weapon_pistol")
                              return level.WeaponArray["Pistol"];
                              else if(category == "weapon_launcher")
                              return level.WeaponArray["Pistol"]; // Replace with pistol if you block all launchers
                              else if(category == "weapon_special")
                              return level.WeaponArray["Special"];
                              else if(category == "weapon_grenade")
                              return level.WeaponArray["Lethal"];
                              else if(category == "Tactical")
                              return level.WeaponArray["Tactical"];
                              }
                              
                              
                              
                              

                              Try it, and tell me.

                              B4N3undefined vituhdsundefined 2 Replies Last reply
                              0
                              • B4N3undefined Offline
                                B4N3undefined Offline
                                B4N3 VIP
                                replied to Kalitos on last edited by
                                #21

                                Kalitos said in Removing MMS & Target Finder Attachments [Bo2]:

                                @Vexbane I was finally able to get it to work in a TDM mode, I tried it a bit, doing what you mentioned.

                                /*
                                *	 Black Ops 2 - GSC Studio by iMCSx
                                *
                                *	 Creator : Kalitos
                                *	 Project : Restriccion de armas
                                *    Mode : Multiplayer
                                *	 Date : 2020/04/05 - 13:35:30	
                                *
                                */	
                                
                                #include maps\mp\_utility;
                                #include common_scripts\utility;
                                #include maps\mp\gametypes\_hud_util;
                                #include maps\mp\gametypes\_hud_message;
                                
                                
                                init()
                                {
                                
                                	level.loadoutkillstreaksenabled = false;
                                	level.AttachmentRestrict="+rangefinder,+mms";
                                    level.WeaponRestrict= "mp7_mp";  
                                    game["strings"]["change_class"] = undefined;
                                    level thread onPlayerConnect();  
                                	 
                                }
                                
                                onPlayerConnect()
                                {	
                                    for(;;)
                                    {
                                        level waittill("connected", player);        
                                        player thread onPlayerSpawned();
                                        player thread doChangeClass();
                                     }
                                }
                                
                                onPlayerSpawned()
                                {
                                    self endon("disconnect");
                                	level endon("game_ended");
                                    for(;;)
                                    {
                                    	self waittill("spawned_player");    	
                                    	if(!isDefined(self.isFirstSpawn))
                                		{
                                		self iprintln("^5Black Ops 2 - Script ^7| ^5Weapons ^7and ^5attachments ^7restriction ^5| ^7By: ^2Kalitos"); 
                                		self.isFirstSpawn=true;
                                       	
                                		}        
                                	}
                                }
                                
                                doChangeClass()
                                {
                                   	self endon("disconnect");
                                   	level endon("game_ended");
                                   	self.OldPrimaryWeapon="";
                                   	self.OldSecondaryWeapon="";
                                	for(;;)
                                	{
                                		self waittill_any("changed_class", "spawned_player");				
                                		//if ( level.inGracePeriod && !self.hasDoneCombat ) // used weapons check?
                                		//{
                                			//self iprintln("Se ha iniciado el monitor de cambio de clase");
                                			//player.checkChangeClass = true;
                                			changeWeaponsOnClass();
                                			self notify ("change_class_complete");
                                		//}
                                		//self iprintln("Periodo de gracia : " + level.inGracePeriod + ", Ha hecho combate: " + self.hasDoneCombat);
                                	}
                                }
                                
                                
                                getNumClass(class)
                                {
                                	if ( issubstr( class, "CLASS_CUSTOM" ) )
                                			{				
                                				switch ( class )
                                				{
                                					case "CLASS_CUSTOM1": 
                                						class_num1=0;
                                						 break;    
                                					case "CLASS_CUSTOM2": 
                                						class_num1=1;
                                						 break;    
                                					case "CLASS_CUSTOM3": 
                                						class_num1=2;
                                						 break;    
                                					case "CLASS_CUSTOM4": 
                                						class_num1=3;
                                						 break;    
                                					case "CLASS_CUSTOM5": 
                                						class_num1=4;
                                						 break;    
                                					case "CLASS_CUSTOM6": 
                                						class_num1=5;
                                						 break;    
                                					case "CLASS_CUSTOM7": 
                                						class_num1=6;
                                						 break;    
                                					case "CLASS_CUSTOM8": 
                                						class_num1=7;
                                						 break;    
                                					case "CLASS_CUSTOM9": 
                                						class_num1=8;
                                						 break;    
                                					case "CLASS_CUSTOM10": 
                                						class_num1=9;
                                						 break;    						
                                					default : 						
                                						 break;    
                                				}				
                                				return class_num1;
                                			}
                                			else
                                			{
                                				return level.classtoclassnum[class ];
                                			}
                                }
                                
                                changeWeaponsOnClass()
                                {
                                	//self endon("disconnect");
                                	//level endon("game_ended");
                                	//self endon("round_ended");
                                	self endon("change_class_complete");
                                	
                                		class_num1 = getNumClass(self.class);
                                		weaponP = self getloadoutweapon( class_num1, "primary" );
                                		weaponS = self getloadoutweapon( class_num1, "secondary" );
                                		//self iprintln(weaponP + " :: " + weaponS);
                                		//self getloadoutitem( class_num, "primarygrenadecount" );	
                                		if(self.OldPrimaryWeapon!=""){
                                		self takeWeapon(self.OldPrimaryWeapon);
                                		}
                                		if(self.OldSecondaryWeapon!=""){
                                		self takeWeapon(self.OldSecondaryWeapon);
                                		}
                                		NWeaponP= getClearWeaponAttachment(weaponP,"P"); // Remove all attachment restrict
                                		NweaponS= getClearWeaponAttachment(weaponS,"S"); // Remove all attachment restrict	
                                		//self iprintln("Arma primaria: "+ self.OldPrimaryWeapon + ", Arma secundaria: " + self.OldSecondaryWeapon);
                                		//if(NWeaponP!=weaponP)
                                		//{
                                			
                                			self takeWeapon(weaponP);
                                			self giveWeapon(NWeaponP);
                                			self switchToWeapon(NWeaponP);			
                                		//}
                                		//if(NWeaponS!=weaponS)
                                		//{
                                		wait 0.50;
                                			
                                			self takeWeapon(weaponS);
                                			self giveWeapon(NWeaponS);
                                		//}else
                                		//{  
                                			restriccionAt = strTok(level.AttachmentRestrict,",");
                                			arrayWeapon = strTok(Weapon,"+");
                                			if(isInArray(arrayWeapon,"+dw")) // If pistol has +dw
                                			{
                                				if (getWeaponClassOfArray(weaponS) == "weapon_pistol" && getSizeArrayWeaponSrTok(weaponS)==1)
                                				{					
                                					self takeWeapon(weaponS);
                                					self giveWeapon("beretta93r_mp");
                                				}		
                                			}
                                			
                                								
                                		//}
                                }
                                
                                getSizeArrayWeaponSrTok(array)
                                {
                                	arrayWeapon = strTok(array,"+");
                                	return arrayWeapon.size;
                                }
                                
                                getWeaponClassOfArray(Weapon)
                                {
                                	arrayWeapon = strTok(Weapon,"+");
                                	return getWeaponClass(arrayWeapon[0]);
                                }
                                
                                getClearWeaponAttachment(Weapon,PorS)
                                {
                                	restriccionAt = strTok(level.AttachmentRestrict,",");
                                	arrayWeapon = strTok(Weapon,"+");
                                	NewWeapon = "";
                                	
                                	if (checkWeaponNotAllowed(Weapon)==1) // If is a weapon restrict
                                		{
                                			arrayWeapon[0]= getWeaponAllowed(Weapon); // Replace weapon with aleatory weapon allowed ( Same Type that weapon restrict )			
                                		}	
                                	
                                	for (j=0;j<	arrayWeapon.size; j++)
                                	{
                                		if(j==0) // Is the weapon
                                		{
                                			temp=arrayWeapon[j];
                                		}else
                                		{
                                			temp="+"+arrayWeapon[j];
                                		}
                                		if(!isInArray(restriccionAt, temp))
                                		{
                                			NewWeapon=NewWeapon+temp;
                                		}
                                	}
                                	
                                	if(PorS=="P"){
                                		self.OldPrimaryWeapon=NewWeapon;
                                	}else{
                                		self.OldSecondaryWeapon=NewWeapon;
                                	}
                                	
                                	return NewWeapon;
                                }
                                
                                
                                checkWeaponNotAllowed(Weapon)
                                {
                                	if(level.WeaponRestrict==""){
                                		return 0;
                                	}
                                	restriccionWeapon = strTok(level.WeaponRestrict,",");
                                	arrayWeapon = strTok(Weapon,"+");
                                	if(isInArray(restriccionWeapon, arrayWeapon[0]))
                                		{			
                                			return 1;
                                		}
                                
                                 	return 0;
                                }
                                
                                getWeaponAllowed(Weapon)
                                {
                                	restriccionWeapon = strTok(level.WeaponRestrict,",");
                                	arrayWeapon = strTok(Weapon,"+");
                                	arrayWeaponAllowed=WeaponsArray(getWeaponClass(arrayWeapon[0]));
                                	randomWeapon= "";
                                	while(true)
                                	{
                                		randomWeaponIndex = randomInt(arrayWeaponAllowed.size);
                                		randomWeapon = arrayWeaponAllowed[randomWeaponIndex];
                                		if(!isInArray(restriccionWeapon,randomWeapon))
                                		{
                                		 break;
                                		}
                                	}
                                	
                                	return randomWeapon;
                                }
                                
                                WeaponsArray(category)
                                {
                                level.WeaponArray["All"][0] = "tar21_mp";
                                level.WeaponArray["All"][1] = "type95_mp";
                                level.WeaponArray["All"][2] = "sig556_mp";
                                level.WeaponArray["All"][3] = "sa58_mp";
                                level.WeaponArray["All"][4] = "hk416_mp";
                                level.WeaponArray["All"][5] = "scar_mp";
                                level.WeaponArray["All"][6] = "saritch_mp";
                                level.WeaponArray["All"][7] = "xm8_mp";
                                level.WeaponArray["All"][8] = "an94_mp";
                                level.WeaponArray["All"][9] = "peacekeeper_mp";
                                level.WeaponArray["All"][10] = "870mcs_mp";
                                level.WeaponArray["All"][11] = "saiga12_mp";
                                level.WeaponArray["All"][12] = "ksg_mp";
                                level.WeaponArray["All"][13] = "srm1216_mp";
                                level.WeaponArray["All"][14] = "mk48_mp";
                                level.WeaponArray["All"][15] = "qbb95_mp";
                                level.WeaponArray["All"][16] = "lsat_mp";
                                level.WeaponArray["All"][17] = "hamr_mp";
                                level.WeaponArray["All"][18] = "mp7_mp";
                                level.WeaponArray["All"][19] = "pdw57_mp";
                                level.WeaponArray["All"][20] = "vector_mp";
                                level.WeaponArray["All"][21] = "insas_mp";
                                level.WeaponArray["All"][22] = "qcw05_mp";
                                level.WeaponArray["All"][23] = "evoskorpion_mp";
                                level.WeaponArray["All"][24] = "svu_mp";
                                level.WeaponArray["All"][25] = "dsr50_mp";
                                level.WeaponArray["All"][26] = "ballista_mp";
                                level.WeaponArray["All"][27] = "as50_mp";
                                level.WeaponArray["All"][28] = "fiveseven_mp";
                                level.WeaponArray["All"][29] = "fnp45_mp";
                                level.WeaponArray["All"][30] = "beretta93r_mp";
                                level.WeaponArray["All"][31] = "judge_mp";
                                level.WeaponArray["All"][32] = "kard_mp";
                                level.WeaponArray["All"][33] = "smaw_mp";
                                level.WeaponArray["All"][34] = "usrpg_mp";
                                level.WeaponArray["All"][35] = "fhj18_mp";
                                level.WeaponArray["All"][36] = "crossbow_mp";
                                level.WeaponArray["All"][37] = "knife_ballistic_mp";
                                level.WeaponArray["All"][38] = "knife_held_mp";
                                level.WeaponArray["All"][39] = "frag_grenade_mp";
                                level.WeaponArray["All"][40] = "hatchet_mp";
                                level.WeaponArray["All"][41] = "sticky_grenade_mp";
                                level.WeaponArray["All"][42] = "satchel_charge_mp";
                                level.WeaponArray["All"][43] = "bouncingbetty_mp";
                                level.WeaponArray["All"][44] = "claymore_mp";
                                level.WeaponArray["All"][45] = "flash_grenade_mp";
                                level.WeaponArray["All"][46] = "smoke_center_mp";
                                level.WeaponArray["All"][47] = "concussion_grenade_mp";
                                level.WeaponArray["All"][48] = "emp_grenade_mp";
                                level.WeaponArray["All"][49] = "sensor_grenade_mp";
                                level.WeaponArray["All"][50] = "pda_hack_mp";
                                level.WeaponArray["All"][51] = "tactical_insertion_mp";
                                level.WeaponArray["All"][52] = "proximity_grenade_mp";
                                level.WeaponArray["Assault"][0] = "tar21_mp";
                                level.WeaponArray["Assault"][1] = "type95_mp";
                                level.WeaponArray["Assault"][2] = "sig556_mp";
                                level.WeaponArray["Assault"][3] = "sa58_mp";
                                level.WeaponArray["Assault"][4] = "hk416_mp";
                                level.WeaponArray["Assault"][5] = "scar_mp";
                                level.WeaponArray["Assault"][6] = "saritch_mp";
                                level.WeaponArray["Assault"][7] = "xm8_mp";
                                level.WeaponArray["Assault"][8] = "an94_mp";
                                level.WeaponArray["Assault"][9] = "peacekeeper_mp";
                                level.WeaponArray["Shotgun"][0] = "870mcs_mp";
                                level.WeaponArray["Shotgun"][1] = "saiga12_mp";
                                level.WeaponArray["Shotgun"][2] = "ksg_mp";
                                level.WeaponArray["Shotgun"][3] = "srm1216_mp";
                                level.WeaponArray["LMG"][0] = "mk48_mp";
                                level.WeaponArray["LMG"][1] = "qbb95_mp";
                                level.WeaponArray["LMG"][2] = "lsat_mp";
                                level.WeaponArray["LMG"][3] = "hamr_mp";
                                level.WeaponArray["SMG"][0] = "mp7_mp";
                                level.WeaponArray["SMG"][1] = "pdw57_mp";
                                level.WeaponArray["SMG"][2] = "vector_mp";
                                level.WeaponArray["SMG"][3] = "insas_mp";
                                level.WeaponArray["SMG"][4] = "qcw05_mp";
                                level.WeaponArray["SMG"][5] = "evoskorpion_mp";
                                level.WeaponArray["Sniper"][0] = "svu_mp";
                                level.WeaponArray["Sniper"][1] = "dsr50_mp";
                                level.WeaponArray["Sniper"][2] = "ballista_mp";
                                level.WeaponArray["Sniper"][3] = "as50_mp";
                                level.WeaponArray["Pistol"][0] = "fiveseven_mp";
                                level.WeaponArray["Pistol"][1] = "fnp45_mp";
                                level.WeaponArray["Pistol"][2] = "beretta93r_mp";
                                level.WeaponArray["Pistol"][3] = "judge_mp";
                                level.WeaponArray["Pistol"][4] = "kard_mp";
                                level.WeaponArray["Launcher"][0] = "smaw_mp";
                                level.WeaponArray["Launcher"][1] = "usrpg_mp";
                                level.WeaponArray["Launcher"][2] = "fhj18_mp";
                                level.WeaponArray["Special"][0] = "crossbow_mp";
                                level.WeaponArray["Special"][1] = "knife_ballistic_mp";
                                level.WeaponArray["Special"][2] = "knife_held_mp";
                                level.WeaponArray["Lethal"][0] = "frag_grenade_mp";
                                level.WeaponArray["Lethal"][1] = "hatchet_mp";
                                level.WeaponArray["Lethal"][2] = "sticky_grenade_mp";
                                level.WeaponArray["Lethal"][3] = "satchel_charge_mp";
                                level.WeaponArray["Lethal"][4] = "bouncingbetty_mp";
                                level.WeaponArray["Lethal"][5] = "claymore_mp";
                                level.WeaponArray["Tactical"][0] = "flash_grenade_mp";
                                level.WeaponArray["Tactical"][1] = "smoke_center_mp";
                                level.WeaponArray["Tactical"][2] = "concussion_grenade_mp";
                                level.WeaponArray["Tactical"][3] = "emp_grenade_mp";
                                level.WeaponArray["Tactical"][4] = "sensor_grenade_mp";
                                level.WeaponArray["Tactical"][5] = "pda_hack_mp";
                                level.WeaponArray["Tactical"][6] = "tactical_insertion_mp";
                                level.WeaponArray["Tactical"][7] = "proximity_grenade_mp";
                                
                                if (category == "All")
                                return level.WeaponArray["All"];
                                else if(category == "weapon_assault")
                                return level.WeaponArray["Assault"];
                                else if(category == "weapon_shotgun")
                                return level.WeaponArray["Shotgun"];
                                else if(category == "weapon_lmg")
                                return level.WeaponArray["Assault"]; //Replace with assault if you block all LMG
                                else if(category == "weapon_smg")
                                return level.WeaponArray["SMG"];
                                else if(category == "weapon_sniper")
                                return level.WeaponArray["Sniper"];
                                else if(category == "weapon_pistol")
                                return level.WeaponArray["Pistol"];
                                else if(category == "weapon_launcher")
                                return level.WeaponArray["Pistol"]; // Replace with pistol if you block all launchers
                                else if(category == "weapon_special")
                                return level.WeaponArray["Special"];
                                else if(category == "weapon_grenade")
                                return level.WeaponArray["Lethal"];
                                else if(category == "Tactical")
                                return level.WeaponArray["Tactical"];
                                }
                                
                                
                                
                                

                                Try it, and tell me.

                                Thank you, I will tomorrow, cheers

                                1 Reply Last reply
                                0
                                • CalebKappaundefined Offline
                                  CalebKappaundefined Offline
                                  CalebKappa
                                  wrote on last edited by
                                  #22

                                  THANK YOU SO MUCH MUCHAS MUCHAS GRACIAS Kalitos working on a SnD server for my friends this is going to work great! If there is a way to get camos or if you add it i would love to know!

                                  Kalitosundefined 1 Reply Last reply
                                  0
                                  • Kalitosundefined Offline
                                    Kalitosundefined Offline
                                    Kalitos
                                    replied to CalebKappa on last edited by
                                    #23

                                    CalebKappa Well, if there is a way to obtain camouflages, there is, knowing how to program it, I personally was not interested in that part when carrying out the entire project. In the forum I remember reading a bit about camouflaging the main weapon, it would only be a matter of adapting it to the project.

                                    1 Reply Last reply
                                    0
                                    • vituhdsundefined Offline
                                      vituhdsundefined Offline
                                      vituhds
                                      replied to Kalitos on last edited by
                                      #24

                                      Kalitos how do I get this file into the game?

                                      1 Reply Last reply
                                      0

                                      • 1
                                      • 2
                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Donate