Announcement

Collapse
No announcement yet.

little help with vehicle restriction

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

  • little help with vehicle restriction

    Id like to restrict some vehicles so that some players cant enter but i need little help. So we got an officer here who cant fly helicopters and planes, but how can i restrict him to enter as gunner for Air,Car and Tank, ive been trying to add atleast another seat (gunner) for Air but no luck. I can add it but then i have to execute 2 scripts,1. for driver 2. for gunner and so on with other vehicle types.

    Code:
    [] spawn {
    	while {(typeOf player == "US_Soldier_Officer_EP1")} do {
    		waitUntil {vehicle player isKindOf "Air"};
    		_Air = (vehicle player);
    		waitUntil {(player == driver _Air) || !(player in _Air)};
    		if (player == driver _Air) then {
    			player action ["eject",vehicle player];
    		};
    	};
    }

  • #2
    Re: little help with vehicle restriction

    Now, I'm no veteran at scripting in arma 2, but you need to query the seat first, then eject.

    Code:
    [] 
    spawn 
    {
    	while {(typeOf player == "US_Soldier_Officer_EP1")} do 
    	{
    		waitUntil {vehicle player isKindOf "Air"};
    		_Air = (vehicle player);
    		_seat = assignedVehicleRole player;
    	};
    	if (_seat == Driver) then 
    	{
    		player action ["eject",vehicle player];
    	};
    	if (_seat == Cargo) then 
    	{
    		player action ["eject",vehicle player];
    	};
    	if (_seat == Turret) then 
    	{
    		player action ["eject",vehicle player];
    	};
    };
    }
    [/QUOTE]

    Like I said, I've done barely any scripting in Arma, so I'm not sure this is the correct syntax. But that looks to be correct. The _seat = assignedVehicleRole player; returns the following array values.

    [] - Not assigned to any vehicle
    ["Driver"] - Assigned as driver
    ["Cargo"] - Assigned as cargo
    ["Turret", [turret path]] - Assigned to a turret

    I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

    Comment


    • #3
      Re: little help with vehicle restriction

      Im getting script error

      Code:
      Error in expression <hicleRole player;
      };
      if (_seat == Driver) then 
      {
      player action ["eject",vehicle>
        Error position: <) then 
      {
      player action ["eject",vehicle>
        Error unexpected )
      File C:\Users\Matosh\Documents\ArmA 2\missions\fs.Desert_E\officerestriction.sqf, line 10

      Comment


      • #4
        Re: little help with vehicle restriction

        Code:
        [] 
        spawn 
        {
        	while {(typeOf player == "US_Soldier_Officer_EP1")} do 
        	{
        		waitUntil {vehicle player isKindOf "Air"};
        		_Air = (vehicle player);
        		_seat = (assignedVehicleRole player);
        	};
        	if (_seat == "Driver") then 
        	{
        		player action ["eject",vehicle player];
        	};
        	if (_seat == "Cargo") then 
        	{
        		player action ["eject",vehicle player];
        	};
        	if (_seat == "Turret") then 
        	{
        		player action ["eject",vehicle player];
        	};
        };
        }
        Try this.

        EDIT:

        You can also do this much simpler by running it as a switch function, instead of querying it independently.

        Code:
        [] 
        spawn 
        {
        	while 
        	{
        		(typeOf player == "US_Soldier_Officer_EP1")
        		} do 
        	{
        		waitUntil 
        		{	
        			vehicle player isKindOf "Air"
        		};
        		_Air = (vehicle player);
        		_seat = (assignedVehicleRole player);
        	};
        	switch (_seat) do
        	{
        		case "Driver":
        		{
        			hint "You are driving.";
        		};
        		case "Turret":
        		{
        			hint "You are the gunner.";
        		};
        		case "Cargo":
        		{
        			hint "You are a worthless piece of cargo.";
        		};
        		case ""
        		{
        			hint "You aren't even in a vehicle. wtf.";
        		};
        	};
        };

        I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

        Comment


        • #5
          Re: little help with vehicle restriction

          Still script errors

          Code:
            Error position: <}>
            Error Missing {
          File C:\Users\Matosh\Documents\ArmA 2\missions\fs.Desert_E\officerestriction.sqf, line 23
          Code:
          Error in expression < worthless piece of cargo.";
          };
          case ""
          {
          hint "You aren't even in a vehicle. wt>
            Error position: <{
          hint "You aren't even in a vehicle. wt>
            Error Missing ;
          File C:\Users\Matosh\Documents\ArmA 2\missions\fs.Desert_E\officerestriction.sqf, line 31
          Error in expression < worthless piece of cargo.";
          };
          case ""
          {
          hint "You aren't even in a vehicle. wt>
            Error position: <{
          hint "You aren't even in a vehicle. wt>
            Error Missing ;
          File C:\Users\Matosh\Documents\ArmA 2\missions\fs.Desert_E\officerestriction.sqf, line 31

          Comment


          • #6
            Re: little help with vehicle restriction

            I must be horrible at syntax then. If anyone wants to come in and correct it, that'd be greatly appreciated!

            I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

            Comment


            • #7
              Re: little help with vehicle restriction

              You are not quite so bad, but it does not matter. I inquire more about this and they helped me, so now everything is working properly, and thanks for trying to help me.

              Comment


              • #8
                Re: little help with vehicle restriction

                Originally posted by matosh View Post
                You are not quite so bad, but it does not matter. I inquire more about this and they helped me, so now everything is working properly, and thanks for trying to help me.
                No problem! Glad I could atleast try... lol

                I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones. -Albert Einstein

                Comment

                Connect

                Collapse

                TeamSpeak 3 Server

                Collapse

                Advertisement

                Collapse

                Twitter Feed

                Collapse

                Working...
                X