Announcement

Collapse
No announcement yet.

Weapon class restrictions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Weapon class restrictions

    Anyone here have come across a script that only allows certain types of weapons in relation to the soldier class?

    Closest thing is the crewcheck scripts.

    Suggestions?

    TGU Instructor TG Pathfinder

    Former TGU Dean Former ARMA Admin Former Irregulars Officer

    "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

  • #2
    Re: Weapon class restrictions

    Have a look at Strango's capture and hold script/template. I think he had an option in there to restrict weapons loadout to soldier role?
    BlackDog1




    "What we do in life... echoes in eternity!"

    Comment


    • #3
      Re: Weapon class restrictions

      Here's one way of doing it:

      Code:
      _unitType = typeOf player;
      _allowableWeapons = ["weaponclass1", "weaponclass2", "weaponclass3", "weaponclass4"]; //* Weapon class names to allow a certain class *//
      _weaponPlayer = primaryWeapon player;
      
      while {true} do {
      if (_unitType == "unit_class_name" && _weaponPlayer !in _allowableWeapons) then {
      player removeWeapon _weaponPlayer;
      hint "Your class restricts you from having this weapon\nPlease select a new weapon";}
      else {};
      };


      IN GAME ARMA: |TG-Irr| Lq.Snake

      Comment


      • #4
        Re: Weapon class restrictions

        Thank you BD and nthamma. I'll test your script out nthamma and I'll look for Strago stuff.

        TGU Instructor TG Pathfinder

        Former TGU Dean Former ARMA Admin Former Irregulars Officer

        "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

        Comment


        • #5
          Re: Weapon class restrictions

          if you want to only show the weapons in the ammo box depending on their class, here is a much simpler way:

          This script must be run client side so if you try to preview it from the editor without creating a dedicated server to test, then the script will not run. If you want to test it from the editor, remove "!isServer" and replace it with "true".

          ammo.sqf called by null = this execVM "ammo.sqf" in initialization of ammo box
          Code:
          if (!isServer) then {
          _unitType = typeOf player;
          //* Weapon classes are taken from tralic to use in the example *//
          while {alive _this} do
          {
          clearweaponcargo _this;
          clearmagazinecargo _this;
          
          //BIS WEAPON//
          if (_unitType == "USMC_Soldier") then {
          _this addweaponcargo ["RPG7V",10];
          _this addweaponcargo ["strela",2];
          _this addweaponcargo ["PK",5];
          _this addweaponcargo ["RPK_74",7];
          _this addweaponcargo ["Binocular",20];
          _this addweaponcargo ["Makarov",5];
          _this addweaponcargo ["AKS_74_U",15];
          _this addweaponcargo ["AKS_74_pso",3];
          _this addweaponcargo ["AK_74",60];
          _this addweaponcargo ["AK_74_GL",5];
          _this addweaponcargo ["SVD",3];
          };
          //BIS AMMO//
          if (_unitType == "USMC_SoldierS") then {
          _this addMagazineCargo ["PipeBomb",50];
          _this addMagazineCargo ["Mine",50];
          _this addMagazineCargo ["OG7",10];
          _this addMagazineCargo ["PG7VR",5];
          _this addMagazineCargo ["PG7VL",20];
          _this addMagazinecargo ["Strela",2];
          _this addmagazinecargo ["100Rnd_762x54_PK",60];
          _this addmagazinecargo ["75Rnd_545x39_RPK",60];
          _this addmagazinecargo ["8Rnd_9x18_Makarov",40];
          _this addmagazinecargo ["30Rnd_545x39_AK",400];
          _this addmagazinecargo ["10Rnd_762x54_SVD",50];
          _this addmagazinecargo ["1Rnd_HE_GP25",50];
          _this addmagazinecargo ["HandGrenade",50];
          };
          
          sleep 3600;
          };
          };
          wherever you see " _unitType == "some_class_name" ", you can change it to whatever class name you want it to see. Feel free to change the weapon and magazine class names to w/e you desire. Happy editing!

          Edit: However, there could be some issues with this script. A player that is a particular class can easily take a weapon and then put it back into the ammo box for another player to take who is a different class than the other one.

          To avoid that:

          Code:
          if (!isServer) then {
          _unitType = typeOf player;
          //* Weapon classes are taken from tralic to use in the example *//
          
          clearweaponcargo _this;
          clearmagazinecargo _this;
          
          //BIS WEAPON//
          if (_unitType == "USMC_Soldier") then {
          _this addweaponcargo ["RPG7V",10];
          _this addweaponcargo ["strela",2];
          _this addweaponcargo ["PK",5];
          _this addweaponcargo ["RPK_74",7];
          _this addweaponcargo ["Binocular",20];
          _this addweaponcargo ["Makarov",5];
          _this addweaponcargo ["AKS_74_U",15];
          _this addweaponcargo ["AKS_74_pso",3];
          _this addweaponcargo ["AK_74",60];
          _this addweaponcargo ["AK_74_GL",5];
          _this addweaponcargo ["SVD",3];
          };
          //BIS AMMO//
          if (_unitType == "USMC_SoldierS") then {
          _this addMagazineCargo ["PipeBomb",50];
          _this addMagazineCargo ["Mine",50];
          _this addMagazineCargo ["OG7",10];
          _this addMagazineCargo ["PG7VR",5];
          _this addMagazineCargo ["PG7VL",20];
          _this addMagazinecargo ["Strela",2];
          _this addmagazinecargo ["100Rnd_762x54_PK",60];
          _this addmagazinecargo ["75Rnd_545x39_RPK",60];
          _this addmagazinecargo ["8Rnd_9x18_Makarov",40];
          _this addmagazinecargo ["30Rnd_545x39_AK",400];
          _this addmagazinecargo ["10Rnd_762x54_SVD",50];
          _this addmagazinecargo ["1Rnd_HE_GP25",50];
          _this addmagazinecargo ["HandGrenade",50];
          
          while {alive _this} do
          {
          _inventoryWeapons = weapons _this;
          _inventoryAmmo = magazines _this;
          clearWeaponCargo _this;
          clearMagazineCargo _this;
          {_this addWeaponCargo [_x, 1]} forEach _inventoryWeapons;
          {_this addMagazineCargo [_x, 1]} forEach _inventoryAmmo;
          sleep 0.1;
          };
          };
          If you try this, let me know if it doesn't work. I haven't tested it.
          Last edited by nthamma; 09-04-2009, 12:52 AM.


          IN GAME ARMA: |TG-Irr| Lq.Snake

          Comment

          Connect

          Collapse

          TeamSpeak 3 Server

          Collapse

          Advertisement

          Collapse

          Twitter Feed

          Collapse

          Working...
          X