Guest User

Cop Interaction Menu

a guest
Jul 30th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_copInteractionMenu.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Replaces the mass addactions for various cop actions towards another player.
  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","_seizeRank","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_Btn7","_Btn8"];
  20.  
  21. disableSerialization;
  22. _curTarget = param [0,objNull,[objNull]];
  23. _seizeRank = LIFE_SETTINGS(getNumber,"seize_minimum_rank");
  24.  
  25. if (player getVariable ["Escorting", false]) then {
  26. if (isNull _curTarget) exitWith {closeDialog 0;}; //Bad target
  27. if (!isPlayer _curTarget && side _curTarget isEqualTo civilian) exitWith {closeDialog 0;}; //Bad side check?
  28. if (player distance _curTarget > 4 ) exitWith {closeDialog 0;}; // Prevents menu accessing from far distances.
  29. };
  30.  
  31. if (!dialog) then {
  32. createDialog "pInteraction_Menu";
  33. };
  34.  
  35. _display = findDisplay 37400;
  36. _Btn1 = _display displayCtrl Btn1;
  37. _Btn2 = _display displayCtrl Btn2;
  38. _Btn3 = _display displayCtrl Btn3;
  39. _Btn4 = _display displayCtrl Btn4;
  40. _Btn5 = _display displayCtrl Btn5;
  41. _Btn6 = _display displayCtrl Btn6;
  42. _Btn7 = _display displayCtrl Btn7;
  43. _Btn8 = _display displayCtrl Btn8;
  44. life_pInact_curTarget = _curTarget;
  45.  
  46. if (player getVariable["isEscorting",false]) then {
  47. { _x ctrlShow false; } forEach [_Btn1,_Btn2,_Btn3,_Btn5,_Btn6,_Btn7,_Btn8];
  48. };
  49.  
  50. //Set Unrestrain Button
  51. _Btn1 ctrlSetText localize "STR_pInAct_Unrestrain";
  52. _Btn1 buttonSetAction "[life_pInact_curTarget] call life_fnc_unrestrain; closeDialog 0;";
  53.  
  54. //Set Check Licenses Button
  55. _Btn2 ctrlSetText localize "STR_pInAct_checkLicenses";
  56. _Btn2 buttonSetAction "[player] remoteExecCall [""life_fnc_licenseCheck"",life_pInact_curTarget]; closeDialog 0;";
  57.  
  58. //Set Search Button
  59. _Btn3 ctrlSetText localize "STR_pInAct_SearchPlayer";
  60. _Btn3 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_searchAction; closeDialog 0;";
  61.  
  62. //Set Escort Button
  63. if (player getVariable["isEscorting",false]) then {
  64. _Btn4 ctrlSetText localize "STR_pInAct_StopEscort";
  65. _Btn4 buttonSetAction "[] call life_fnc_stopEscorting; closeDialog 0;";
  66. } else {
  67. _Btn4 ctrlSetText localize "STR_pInAct_Escort";
  68. _Btn4 buttonSetAction "[life_pInact_curTarget] call life_fnc_escortAction; closeDialog 0;";
  69. };
  70.  
  71. //Set Ticket Button
  72. _Btn5 ctrlSetText localize "STR_pInAct_TicketBtn";
  73. _Btn5 buttonSetAction "[life_pInact_curTarget] call life_fnc_ticketAction;";
  74.  
  75. _Btn6 ctrlSetText localize "STR_pInAct_Arrest";
  76. _Btn6 buttonSetAction "[life_pInact_curTarget] call life_fnc_arrestAction; closeDialog 0;";
  77. _Btn6 ctrlEnable false;
  78.  
  79. _Btn7 ctrlSetText localize "STR_pInAct_PutInCar";
  80. _Btn7 buttonSetAction "[life_pInact_curTarget] call life_fnc_putInCar; closeDialog 0;";
  81.  
  82. //SeizeWeapons Button
  83. _Btn8 ctrlSetText localize "STR_pInAct_Seize";
  84. _Btn8 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_seizePlayerAction; closeDialog 0;";
  85.  
  86. if (FETCH_CONST(life_coplevel) < _seizeRank) then {_Btn8 ctrlEnable false;};
  87.  
  88. {
  89. if ((player distance (getMarkerPos _x) <30)) exitWith { _Btn6 ctrlEnable true;};
  90. } forEach LIFE_SETTINGS(getArray,"sendtoJail_locations");
Add Comment
Please, Sign In to add comment