Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
1,381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. /*
  2. XM8 App Base Location Markers
  3. Name: basemarker.sqf
  4. Created by Lunchbox for use with Exile mod for Arma 3.
  5. Copyright 2016, Lunchbox, All rights reserved.
  6. Shows the locations of the bases you have rights to.
  7. */
  8.  
  9. disableSerialization;
  10. _display = uiNameSpace getVariable ["RscExileXM8", displayNull];
  11.  
  12. _xm8Controls = [991,881,992,882,993,883,994,884,995,885,996,886,997,887,998,888,999,889,9910,8810,9911,8811,9912,8812];
  13. {
  14. _fade = _display displayCtrl _x;
  15. _fade ctrlSetFade 1;
  16. _fade ctrlCommit 0.5;
  17. } forEach _xm8Controls;
  18. {
  19. ctrlDelete ((findDisplay 24015) displayCtrl _x);
  20. } forEach _xm8Controls;
  21.  
  22. (_display displayCtrl 4004) ctrlSetStructuredText (parseText (format ["<t align='center' font='RobotoMedium'>Base Markers</t>"]));
  23.  
  24. // Buttons and text.
  25.  
  26. _OnBtn = _display ctrlCreate ["RscButtonMenu", 15002];
  27. _OnBtn ctrlSetPosition [(32 - 20) * (0.025),(20 - 10) * (0.04),6 * (0.025),1 * (0.04)];
  28. _OnBtn ctrlCommit 0;
  29. _OnBtn ctrlSetText "On";
  30. _OnBtn ctrlSetEventHandler ["ButtonClick", "call fnc_markerOn"];
  31.  
  32. _OffBtn = _display ctrlCreate ["RscButtonMenu", 15003];
  33. _OffBtn ctrlSetPosition [(32 - 10) * (0.025),(20 - 10) * (0.04),6 * (0.025),1 * (0.04)];
  34. _OffBtn ctrlCommit 0;
  35. _OffBtn ctrlSetText "Off";
  36. _OffBtn ctrlSetEventHandler ["ButtonClick", "call fnc_markerOff"];
  37.  
  38. _BackBtn = _display ctrlCreate ["RscButtonMenu", 15004];
  39. _BackBtn ctrlSetPosition [(32 - 3) * (0.025),(20 - 2) * (0.04),6 * (0.025),1 * (0.04)];
  40. _BackBtn ctrlCommit 0;
  41. _BackBtn ctrlSetText "Go Back";
  42. _BackBtn ctrlSetEventHandler ["ButtonClick", "call fnc_Back"];
  43.  
  44. _Instruction = _display ctrlCreate ["RscStructuredText", 15005];
  45. _Instruction ctrlSetPosition [(5.8 - 3) * (0.025), (20 - 12) * (0.04), 7.2 * (0.12), 3.75 * (0.02)];
  46. _Instruction ctrlCommit 0;
  47. _Instruction ctrlSetStructuredText parseText "<t size='1' align='center'>Toggle your base markers (Only viewable by you):</t>";
  48.  
  49. // Functions
  50.  
  51. fnc_Back = {
  52.  
  53. _display = uiNameSpace getVariable ["RscExileXM8", displayNull];
  54. _vdCtrls = [15002,15003,15004,15005];
  55. {
  56. _ctrl = (_display displayCtrl _x);
  57. _ctrl ctrlSetFade 1;
  58. _ctrl ctrlCommit 0.25;
  59. ctrlEnable [_x, false];
  60. } forEach _vdCtrls;
  61. execVM "xm8Apps\XM8Apps_Init.sqf";
  62. Sleep 1;
  63. {
  64. ctrlDelete ((findDisplay 24015) displayCtrl _x);
  65. } forEach _vdCtrls;
  66.  
  67. };
  68.  
  69.  
  70. fnc_markerOn = {
  71.  
  72. _playerUID = getPlayerUID player;
  73. {
  74. _flag = _x;
  75. _buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
  76. if (_playerUID in _buildRights) then
  77. {
  78. _name = _flag getVariable ["ExileTerritoryName", ""];
  79. _pos = getPos _flag;
  80. _marker = createMarkerLocal [_name, _pos];
  81. _marker setMarkerTextLocal _name;
  82. _marker setMarkerTypeLocal "mil_flag";
  83. _marker setMarkerColorLocal "ColorYellow"
  84. };
  85. }
  86. forEach (allMissionObjects "Exile_Construction_Flag_Static");
  87. (findDisplay 24015) closeDisplay 0;
  88. ["Success",["Base Markers toggled on."]] call ExileClient_gui_notification_event_addNotification;
  89. };
  90.  
  91. fnc_markerOff = {
  92.  
  93. _playerUID = getPlayerUID player;
  94. {
  95. _flag = _x;
  96. _buildRights = _flag getVariable ["ExileTerritoryBuildRights", []];
  97. if (_playerUID in _buildRights) then
  98. {
  99. _name = _flag getVariable ["ExileTerritoryName", ""];
  100. _pos = getPos _flag;
  101. deleteMarkerLocal _name;
  102.  
  103. };
  104. }
  105. forEach (allMissionObjects "Exile_Construction_Flag_Static");
  106. (findDisplay 24015) closeDisplay 0;
  107. ["Whoops",["Base Markers toggled off."]] call ExileClient_gui_notification_event_addNotification;
  108.  
  109. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement