Authorised Crew Check

From F2 EN
Jump to navigation Jump to search

Description

One way of encouraging players to stick to their designated roles is to prevent certain units from acting as pilots / drivers / gunners or commanders of specialist vehicles such as tanks and aircraft. The Authorised Crew Check component is a quick and easy way of ensuring that only players in selected slots are able to act as crew-members on particular vehicles. If a player that is not authorised to act as crew attempts to get in as anything except cargo (passenger), s/he will be automatically ejected with a warning message.

Additionally, the warning message has also been translated into English, Czech, German, Polish, Spanish, French and Russian (using text strings contained in the file stringtable.csv); players using copies of ArmA2 released in those languages will automatically see the translated warning.

AuthorisedCrewCheck1.jpg


Required files

All the code associated with this component is found in:

  • init.sqf
  • stringtable.xml
  • f\common\f_isAuthorisedCrew.sqf

How to activate

See section below.

How to use

Setting authorised crew for a vehicle

In the ArmA2 editor, select the vehicle and ensure it has a name in the Name: field (such as MyTank).

Still in the editor, make sure the playable slots that you want to have as the authorised crew-members also have unique entries in their Name: field (such as MyDriver, MyCommander and MyGunner). Note that all units in the ShackTactical Platoons have values in their Name: fields already, which you can use.

Open the file init.sqf and look for the code segment entitled:

// F2 - Authorised Crew Check

Edit the following line, removing the // at the start, replacing VehicleName with the name of the vehicle, and the array [UnitName1,UnitName2] with an array containing the names of the authorised crew members.

// VehicleName addEventhandler ["GetIn", {[_this,[UnitName1,UnitName2]] execVM "f\common\f_isAuthorisedCrew.sqf"}];

For example, to ensure that only MyDriver, MyCommander and MyGunner can act as the crew of MyTank, change the line to:

MyTank addEventhandler ["GetIn", {[_this,[MyDriver,MyCommander,MyGunner]] execVM "f\common\f_isAuthorisedCrew.sqf"}];

Tips

  • There is a known limitation with this feature: if a unit enters a vehicle as a passenger, s/he can sometimes use the action menu to move to a pilot / driver / commander / gunner position.

Credits

  • white angel
  • Ricardo
  • eJay
  • Raedor
  • Rom
  • Fer