Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. /*
  2. Crew check script - v0.3
  3. Checks for crew in positions of vehicle
  4. Created by BearBison
  5. */
  6. /* Private variables */
  7. private ["_Vehicle","_Soldier","_Position","_CrewCheck"];
  8. /* Defines the variables */
  9. _Vehicle = _this select 0;
  10. _Position = _this select 1;
  11. _Soldier = _this select 2;
  12. /* Checks the crew */
  13. _CrewCheck =
  14. {
  15. switch (_Position) do
  16. {
  17. case "driver":
  18. {
  19. switch (true) do
  20. {
  21. case (_Vehicle isKindOf "LIB_Tank_Base"):
  22. {
  23. if (typeOf _Soldier == "LIB_GER_spg_lieutenant") exitWith {};
  24. _Vehicle vehicleChat "You need to be a tank crewman to use this vehicle";
  25. sleep 1;
  26. _Soldier action ["getout",_Vehicle];
  27. };
  28. default
  29. {
  30. if (typeOf _Soldier == "LIB_GER_spg_crew") exitWith {};
  31. _Vehicle vehicleChat "You need to be a tank crewman to use this vehicle";
  32. sleep 1;
  33. _Soldier action ["getout",_Vehicle];
  34. };
  35. };
  36. };
  37. case "gunner":
  38. {
  39. switch (true) do
  40. {
  41. case (_Vehicle isKindOf "LIB_Tank_Base"):
  42. {
  43. if (typeOf _Soldier == "LIB_GER_spg_lieutenant") exitWith {};
  44. _Vehicle vehicleChat "You need to be a tank crewman to use this vehicle";
  45. sleep 1;
  46. _Soldier action ["getout",_Vehicle];
  47. };
  48. default
  49. {
  50. if (typeOf _Soldier == "LIB_GER_spg_crew") exitWith {};
  51. _Vehicle vehicleChat "You need to be a tank crewman to use this vehicle";
  52. sleep 1;
  53. _Soldier action ["getout",_Vehicle];
  54. };
  55. };
  56. };
  57. case "Turret":
  58. {
  59. switch (true) do
  60. {
  61. case (_Vehicle isKindOf "LIB_Tank_Base"):
  62. {
  63. if (typeOf _Soldier == "LIB_GER_spg_lieutenant") exitWith {};
  64. _Vehicle vehicleChat "You need to be a tank crewman to use this vehicle";
  65. sleep 1;
  66. _Soldier action ["getout",_Vehicle];
  67. };
  68. default
  69. {
  70. if (typeOf _Soldier == "LIB_GER_spg_crew") exitWith {};
  71. _Vehicle vehicleChat "You need to be a tank crewman to use this vehicle";
  72. sleep 1;
  73. _Soldier action ["getout",_Vehicle];
  74. };
  75. };
  76. };
  77. };
  78. };
  79. /* Calls crew check */
  80. call _CrewCheck;
  81. /* Waits until position is changed */
  82. waitUntil {((assignedVehicleRole _Soldier) select 0 != "cargo")||(vehicle _Soldier == _Soldier)};
  83. sleep 1;
  84. /* Exits if no longer in a vehicle */
  85. if (vehicle _Soldier == _Soldier) exitwith {};
  86. /* Gets new position */
  87. _Position = (assignedVehicleRole _Soldier) select 0;
  88. /* Calls crew check */
  89. call _CrewCheck;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement