player.sqf 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. if (debugMode) exitWith {};
  2. waitUntil { !isNil "serverInitComplete" };
  3. //Marker and action syncing
  4. if (isNull player) then
  5. {
  6. [] call AW_fnc_JIPmarkers;
  7. [] call AW_fnc_JIPactions;
  8. } else {
  9. localMarkers = [];
  10. };
  11. //Roles / weapon restrictions
  12. if (PARAMS_restrictWeapons == 1) then
  13. {
  14. waitUntil { !isNil "VAS_init_complete" && VAS_init_complete };
  15. [] call AW_fnc_getRoleItems;
  16. };
  17. //Radio channels
  18. [] call AW_fnc_setRadioChannels;
  19. //Pilot restrictions
  20. if (PARAMS_pilotRestrictions > 0) then
  21. {
  22. player addEventHandler
  23. [
  24. "GetIn",
  25. {
  26. _veh = _this select 0;
  27. if ((_veh isKindOf "Helicopter" && !(_veh isKindOf "ParachuteBase")) || _veh isKindOf "Plane") then
  28. {
  29. if ((_this select 1) == "driver") then
  30. {
  31. _canFly = switch (PARAMS_pilotRestrictions) do
  32. {
  33. case 1: //Pilots only
  34. {
  35. _role = player getVariable ["role", "none"];
  36. if (!(_role == "pilot")) then
  37. {
  38. "a pilot"
  39. } else {
  40. ""
  41. };
  42. };
  43. case 2:
  44. {
  45. _isAdmin = serverCommandAvailable "#kick";
  46. if (!_isAdmin) then
  47. {
  48. "an administrator"
  49. } else {
  50. ""
  51. };
  52. };
  53. case 3:
  54. {
  55. _role = player getVariable ["role", "none"];
  56. _isAdmin = serverCommandAvailable "#kick";
  57. if (!(_role == "pilot") && !_isAdmin) then
  58. {
  59. "either a pilot or an administrator"
  60. } else {
  61. ""
  62. };
  63. };
  64. default { "" };
  65. };
  66. if (!(_canFly == "")) then
  67. {
  68. player action ["eject", _veh];
  69. waitUntil { vehicle player == player };
  70. player action ["engineOff", _veh];
  71. _name = "GET VEHICLE NAME HERE";
  72. hint parseText format["<t color='#FF0000' size='2.2'>Restricted<br/>Vehicle</t><br/>--------------------<br/>You're not qualified to fly the %1; you must be %2!", _name, _canFly];
  73. };
  74. };
  75. };
  76. }
  77. ];
  78. };