Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.43 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_houseMenu.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Building interaction menu
  8. */
  9. #define Btn1 37450
  10. #define Btn2 37451
  11. #define Btn3 37452
  12. #define Btn4 37453
  13. #define Btn5 37454
  14. #define Btn6 37455
  15. #define Btn7 37456
  16. #define Btn8 37457
  17. #define Title 37401
  18.  
  19. private["_display","_curTarget","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_Btn7","_Btn8"];
  20. disableSerialization;
  21. _curTarget = param [0,objNull,[objNull]];
  22. if (isNull _curTarget) exitWith {}; //Bad target
  23. if (playerSide isEqualTo independent) exitWith {};
  24. _houseCfg = [(typeOf _curTarget)] call life_fnc_houseConfig;
  25. if (count _houseCfg isEqualTo 0 && playerSide isEqualTo civilian) exitWith {};
  26.  
  27. if (!dialog) then {
  28. createDialog "pInteraction_Menu";
  29. };
  30.  
  31. _Btn1 = CONTROL(37400,Btn1);
  32. _Btn2 = CONTROL(37400,Btn2);
  33. _Btn3 = CONTROL(37400,Btn3);
  34. _Btn4 = CONTROL(37400,Btn4);
  35. _Btn5 = CONTROL(37400,Btn5);
  36. _Btn6 = CONTROL(37400,Btn6);
  37. _Btn7 = CONTROL(37400,Btn7);
  38. _Btn8 = CONTROL(37400,Btn8);
  39. {_x ctrlShow false;} forEach [_Btn1,_Btn2,_Btn3,_Btn4,_Btn5,_Btn6,_Btn7,_Btn8];
  40.  
  41. life_pInact_curTarget = _curTarget;
  42. //Fed Bank
  43. //-- Main Building : Land_MilOffices_V1_F : 15286.833,17470.777,0
  44. //-- Safe Building : Land_Research_house_V1_F : 15288.094,17478.21,0.896
  45. if (_curTarget isKindOf "House_F" || _curTarget isKindOf "Land_BackAlley_01_l_gate_F" && playerSide isEqualTo west) exitWith {
  46. if ((nearestObject [[15286.833,17470.777,0],"Land_MilOffices_V1_F"]) == _curTarget || (nearestObject [[15288.094,17478.21,0.896],"Land_Research_house_V1_F"]) == _curTarget || (nearestObject [[8226.775,10890.019,0.175], "Land_BackAlley_01_l_gate_F"]) == _curTarget || (nearestObject [[8229.058,10888.138,0.165], "Land_i_Shed_Ind_F"]) == _curTarget) then {
  47.  
  48. _Btn1 ctrlSetText localize "STR_pInAct_Repair";
  49. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_repairDoor; closeDialog 0;";
  50. _Btn1 ctrlShow true;
  51.  
  52. _Btn2 ctrlSetText localize "STR_pInAct_CloseOpen";
  53. _Btn2 buttonSetAction "[life_pInact_curTarget] call life_fnc_doorAnimate; closeDialog 0;";
  54. _Btn2 ctrlShow true;
  55.  
  56. } else {
  57. if (!isNil {_curTarget getVariable "house_owner"}) then {
  58. _Btn1 ctrlSetText localize "STR_House_Raid_Owner";
  59. _Btn1 buttonSetAction "[life_pInact_curTarget] call life_fnc_copHouseOwner;";
  60. _Btn1 ctrlShow true;
  61.  
  62. _Btn2 ctrlSetText localize "STR_pInAct_BreakDown";
  63. _Btn2 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_copBreakDoor; closeDialog 0;";
  64. _Btn2 ctrlShow true;
  65.  
  66. _Btn3 ctrlSetText localize "STR_pInAct_SearchHouse";
  67. _Btn3 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_raidHouse; closeDialog 0;";
  68. _Btn3 ctrlShow true;
  69.  
  70. if (player distance _curTarget > 3.6) then {
  71. _Btn3 ctrlEnable false;
  72. };
  73.  
  74. _Btn4 ctrlSetText localize "STR_pInAct_LockHouse";
  75. _Btn4 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_lockupHouse; closeDialog 0;";
  76. _Btn4 ctrlShow true;
  77. } else {
  78. closeDialog 0;
  79. };
  80. };
  81. };
  82.  
  83. if (!(_curTarget in life_vehicles) || isNil {_curTarget getVariable "house_owner"}) then {
  84. _Btn1 ctrlSetText localize "STR_pInAct_BuyHouse";
  85. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_buyHouse;";
  86. _Btn1 ctrlShow true;
  87.  
  88. if (!isNil {_curTarget getVariable "house_owner"}) then {
  89. _Btn1 ctrlEnable false;
  90. };
  91. } else {
  92. if ((typeOf _curTarget) in ["Land_i_Garage_V1_F","Land_i_Garage_V2_F"]) then {
  93. _Btn1 ctrlSetText localize "STR_pInAct_SellGarage";
  94. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_sellHouse; closeDialog 0;";
  95. _Btn1 ctrlShow true;
  96.  
  97. if (((_curTarget getVariable "house_owner") select 0) != getPlayerUID player) then {
  98. _Btn1 ctrlEnable false;
  99. };
  100.  
  101. _Btn2 ctrlSetText localize "STR_pInAct_AccessGarage";
  102. _Btn2 buttonSetAction "[life_pInact_curTarget,""Car""] spawn life_fnc_vehicleGarage; closeDialog 0;";
  103. _Btn2 ctrlShow true;
  104.  
  105. _Btn3 ctrlSetText localize "STR_pInAct_StoreVeh";
  106. _Btn3 buttonSetAction "[life_pInact_curTarget,player] spawn life_fnc_storeVehicle; closeDialog 0;";
  107. _Btn3 ctrlShow true;
  108. } else {
  109. _Btn1 ctrlSetText localize "STR_pInAct_SellHouse";
  110. _Btn1 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_sellHouse; closeDialog 0;";
  111. _Btn1 ctrlShow true;
  112.  
  113. if (((_curTarget getVariable "house_owner") select 0) != (getPlayerUID player)) then {
  114. _Btn1 ctrlEnable false;
  115. };
  116.  
  117. if (_curTarget getVariable ["locked",false]) then {
  118. _Btn2 ctrlSetText localize "STR_pInAct_UnlockStorage";
  119. } else {
  120. _Btn2 ctrlSetText localize "STR_pInAct_LockStorage";
  121. };
  122. _Btn2 buttonSetAction "[life_pInact_curTarget] call life_fnc_lockHouse; closeDialog 0;";
  123. _Btn2 ctrlShow true;
  124.  
  125. if (isNull (_curTarget getVariable ["lightSource",objNull])) then {
  126. _Btn3 ctrlSetText localize "STR_pInAct_LightsOn";
  127. } else {
  128. _Btn3 ctrlSetText localize "STR_pInAct_LightsOff";
  129. };
  130. _Btn3 buttonSetAction "[life_pInact_curTarget] call life_fnc_lightHouseAction; closeDialog 0;";
  131. _Btn3 ctrlShow true;
  132. };
  133. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement