Advertisement
Thatguy5532

Halo Menu

Jun 23rd, 2023
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. params["_player"];
  2. private _lastHaloTime = _player getVariable ['TRA_lastHalo', diag_tickTime - 500];
  3. private _timeSinceLastHalo = diag_tickTime - _lastHaloTime;
  4. if (_timeSinceLastHalo <= 120) exitWith {
  5. ["HaloCooldown", [format["Halo jumping is on cooldown... please wait %1 more minutes!", round((120 - _timeSinceLastHalo) / 60)]]] call BIS_fnc_showNotification;
  6. };
  7.  
  8. /* Open Display */
  9. private _display = createDialog ["HaloJumpGui", false];
  10. uiNamespace setVariable ["HALO_display", _display];
  11.  
  12. /* idc codes for each part of display */
  13. private _mapFrame = 1800;
  14. private _btnHalo = 1600;
  15. private _btnCancel = 1601;
  16. private _title = 1000;
  17.  
  18. /* Main Used Display stored for multiple use later */
  19. private _mainDisplay = (findDisplay 46);
  20.  
  21. /* Open Map for player */
  22. private _ctrlMap = _display ctrlCreate ["RscMapControl", -1];
  23. _ctrlMap ctrlMapSetPosition [0.276875 * safezoneW + safezoneX, 0.234 * safezoneH + safezoneY, 0.44625 * safezoneW, 0.476 * safezoneH]; // effect is immediate
  24.  
  25. /* Coords array to pass */
  26. uiNamespace setVariable["TRA_haloCoords", [0, 0, 0]];
  27. createMarkerLocal ["halo_marker", position player];
  28. "halo_marker" setMarkerTypeLocal "Select";
  29. "halo_marker" setMarkerColorLocal "ColorGreen";
  30. uiNamespace setVariable["TRA_haloVehicle", objNull];
  31.  
  32. uiNamespace setVariable['TRA_haloVehicleBool', false];
  33.  
  34. _ctrlMap ctrlAddEventHandler['MouseButtonClick', {
  35. params[ "_map", "_button", "_mouseX", "_mouseY" ];
  36. private _worldCoords = _map ctrlMapScreenToWorld [_mouseX, _mouseY];
  37. private _worldX = _worldCoords select 0;
  38. private _worldY = _worldCoords select 1;
  39.  
  40. private _display = uiNamespace getVariable ["HALO_display", objNull];
  41. private _vehicleCheckBox = cbChecked (_display displayCtrl 2801);
  42. private _curVeh = uiNamespace getVariable["TRA_haloVehicle", objNull];
  43. systemChat (str _curVeh);
  44. if (_vehicleCheckBox && isNull _curVeh) then {
  45. [player] call TRA_selectHaloVeh;
  46. };
  47.  
  48. "halo_marker" setMarkerPosLocal _worldCoords;
  49. uiNamespace setVariable["TRA_haloCoords", [_worldX, _worldY, 2000]];
  50. }];
  51.  
  52. TRA_selectHaloVeh = {
  53. params["_player"];
  54. private _lightVeh = _player nearEntities [["Car", "Motorcycle", "Tank"], 100];
  55. systemChat format["Vehicle Array: %1", str _lightVeh];
  56.  
  57. private _vehicles = _lightVeh apply {
  58. [
  59. [getText(configFile >> "CfgVehicles" >> typeOf _x >> "displayName")],
  60. [],
  61. [getText(configFile >> "CfgVehicles" >> typeOf _x >> "picture")],
  62. [],
  63. getText(configFile >> "CfgVehicles" >> typeOf _x >> "displayName"),
  64. typeOf _x,
  65. getNumber(configFile >> "CfgVehicles" >> typeOf _x >> "scope")
  66. ]
  67. };
  68. [
  69. [
  70. _vehicles,
  71. 0,
  72. false // Multi select disabled
  73. ],
  74. "Vehicle selection",
  75. [{
  76. params["_lightVeh"];
  77. if (_data isNotEqualTo "") then {
  78. systemChat (str _data);
  79. uiNamespace setVariable["TRA_haloVehicle", _lightVeh select _index];
  80. };
  81. },
  82. [_lightVeh]
  83. ],
  84. "SELECT", // reverts to default
  85. "" // reverts to default, disable cancel option
  86. ] call CAU_UserInputMenus_fnc_listbox;
  87. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement