Announcement

Collapse
No announcement yet.

Script Request: LOCK/UNLOCK GATE

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

  • Script Request: LOCK/UNLOCK GATE

    I am looking to create a script that can allow and admin/zues to lock/unlock a gate or door of sorts, using an addaction, to keep assets out of the hands of players without permissions ect... would also be helpful to help manage new players coming into server and get them communicating/grouped prior to heading out on an OP.

    so far I have been able to lock a door of a building but and created an addaction that should allow to unlock/lock, it showes up in menu but won't unlock door. It also will not work at all on a gate which would be the preferred item for myself.

    Code I have in init file:

    this addAction ["<t color='#FF0000'> Unlock Gate</t>", Building1 setVariable["bis_disabled_Door_1",0,true]]; this addAction ["<t color='#FF0000'> lock Gate</t>", building1 setVariable["bis_disabled_Door_1",1,true]];

    I have added this code to a gate and tried naming the gate, using its class name, but nothing works. I am now thinking that this will require an .SQF to accomplish and that is above my level.

    Unkl stated that at one point in the past there was a script on TG that had H barriers that an admin could lower into the ground and allow the plane ect... to be removed from the hanger, if anyone has that script and could convert it to arma 3 that would work fine as well.

    ANY ASSISTANCE IS APPRECIATED!
    May God have mercy upon my enemies, because I won’t.
    -- Gen. George S. Patton


    |TG189th| Cody

  • #2
    Code:
    if (severCommandAvailable "#lock" || player in allCurators) then {give the man the key to the kingdom};
    Here is a start. This would allow access to voted admins and any Zeus. I think placing an object as a barrier might be far easier than trying to animate a gate. A gate could be damaged or knocked over. A spawned in object would continuously replace itself.
    |TG-189th| Unkl
    ArmA 3 Game Officer
    Dean of Tactical Gamer University
    189th Infantry Brigade Member

    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

    Comment


    • #3
      Here is a version for any voted admin to be able to open or close a gate. I've also done another version of this that limits the gates to all Pathfinders/Admins which is on the dev server if you want that one. Any mission makers for TG that want that one may PM me to get that version.

      initPlayerLocal.sqf
      Code:
      waitUntil {!isNull player && player == player};
      []execVM "assetGates.sqf";
      assetGates.sqf
      Code:
      waitUntil { !isNull player };    
      
      
      [] spawn {
          _gateOneObjects = [gate1_1,gate1_2,gate1_3];
          _gateOneController = gateOneDesk;
          gateOneDesk setVariable ["gateStatus","closed",true];
      
          _actionAdded = false;
          _run = true;
          _id = 77;
      
      
          while {_run} do
          {
              if (availableServerCommand "#kick") then
              {        
                  if !(_actionAdded) then
                  {
                      if (gateOneDesk getVariable "gateStatus" == "closed") then
                      {
                          _id = gateOneDesk addAction [
                          "Open Gate",             //STRING
                          "openGate.sqf", //STRING
                          _gateOneObjects,            //ANY
                          -999,            //NUMBER
                          true,            //BOOLEAN
                          false,            //BOOLEAN
                          "",            //STRING
                          "",        //STRING
                          20,                //NUMBER
                          true];        //BOOLEAN
                          _actionAdded = true;
                      };    
                      sleep 1.6;
                  } else {
                      gateOneDesk removeAction _id;
                      _actionAdded = false;
                  };    
                  sleep .1;
              };
          };
      };
      openGate.sqf **note: I removed the animation because it was far to slow in a dedicated server
      Code:
      _caller = _this select 1;
      _gateObjects = _this select 3; 
      gateOneDesk setVariable ["gateStatus","open",true];
      
      {
          _x setVariable ["originalPositionATL", getPosATL _x];
      }forEach _gateObjects;
      
      //animate gate open
      _targetDepth = -3;
      _originalDepth = getPosATL (_gateObjects select 0) select 2;
      _caller sideChat "Opening gate...";
      {
              _x setPosATL [getPosATL _x select 0, getPosATL _x select 1, _targetDepth];
              sleep .1;
      }forEach _gateObjects;
      
      //gate is open
      _caller sideChat "Gate is open for 1 minute.";
      sleep 60;
      
      //close gate
      _targetDepth = _originalDepth;
      _caller sideChat "Closing gate...";
      {
              _x setPosATL [getPosATL _x select 0, getPosATL _x select 1, _originalDepth];
              sleep .1;
      }forEach _gateObjects;
      
      {_x setPosATL (_x getVariable "originalPositionATL");}forEach _gateObjects; //just to make sure they are in the original position
      _caller sideChat "Gate is closed.";
      gateOneDesk setVariable ["gateStatus","closed",true];
      In the mission sqm there is 3 elements to the gate itself gate1_1, gate1_2 and gate1_3. There is a cash desk that is the gateOneDesk which will have the addAction for opening the gate.

      You should make all of these objects so that they can not be damaged. It is also highly suggested you only make a locked area out of objects you place and set them all so they can not be damaged. Otherwise, the hangar you use as an enclosure could be destroyed to gain access to your asset.
      Last edited by Unkl; 02-26-2017, 08:28 AM.
      |TG-189th| Unkl
      ArmA 3 Game Officer
      Dean of Tactical Gamer University
      189th Infantry Brigade Member

      SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

      Comment


      • #4
        have you guys found this to be more effective than just locking or setting a timer for recently connected players?
        Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

        Comment


        • #5
          Don't know just something to try, we shall see. Thanks Unkl
          May God have mercy upon my enemies, because I won’t.
          -- Gen. George S. Patton


          |TG189th| Cody

          Comment


          • #6
            Usually if you lock a vehicle then players just destroy it. If you put it behind a gate they try to destroy the gate. I dunno, but they get the idea that it is restricted on purpose for some reason a little better. It always is nice to have that element of dangling carrot to help entice people to follow along lol.
            |TG-189th| Unkl
            ArmA 3 Game Officer
            Dean of Tactical Gamer University
            189th Infantry Brigade Member

            SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

            Comment


            • #7
              I would actually like a "lock/unlock" gate script for a mission I am trying to make. The idea is that the players are locked in cells and a random cell/gate is chosen, giving the players a hold addaction to open it. The player must then find a button to open the rest of the player's cells, so they can make their escape; by scrounging up whatever they can find.
              I wasn't originally going to get a brain transplant, but then I changed my mind.

              Comment


              • #8
                Originally posted by CaptainShawn123 View Post
                I would actually like a "lock/unlock" gate script for a mission I am trying to make. The idea is that the players are locked in cells and a random cell/gate is chosen, giving the players a hold addaction to open it. The player must then find a button to open the rest of the player's cells, so they can make their escape; by scrounging up whatever they can find.
                this sounds fun!

                Comment


                • #9
                  Unkl can you send me the PBO version, I can not find it on the dev server?
                  May God have mercy upon my enemies, because I won’t.
                  -- Gen. George S. Patton


                  |TG189th| Cody

                  Comment


                  • #10
                    Re-uploaded to the test instance.
                    |TG-189th| Unkl
                    ArmA 3 Game Officer
                    Dean of Tactical Gamer University
                    189th Infantry Brigade Member

                    SUBMIT A RIBBON NOMINATION OR CONTACT AN ARMA ADMIN

                    Comment


                    • #11
                      Got it thanks.
                      May God have mercy upon my enemies, because I won’t.
                      -- Gen. George S. Patton


                      |TG189th| Cody

                      Comment

                      Connect

                      Collapse

                      TeamSpeak 3 Server

                      Collapse

                      Advertisement

                      Collapse

                      Twitter Feed

                      Collapse

                      Working...
                      X