Advertisement
MaxenceTP

Untitled

Mar 2nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 5.45 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 Btn9 37458
  18. #define Title 37401
  19.  
  20. private ["_display","_curTarget","_seizeRank","_Btn1","_Btn2","_Btn3","_Btn4","_Btn5","_Btn6","_Btn7","_Btn8"];
  21.  
  22. disableSerialization;
  23. _curTarget = param [0,objNull,[objNull]];
  24. _seizeRank = LIFE_SETTINGS(getNumber,"seize_minimum_rank");
  25.  
  26. if (player getVariable ["Escorting", false]) then {
  27.     if (isNull _curTarget) exitWith {closeDialog 0;}; //Bad target
  28.     if (!isPlayer _curTarget && side _curTarget isEqualTo civilian) exitWith {closeDialog 0;}; //Bad side check?
  29.     if (player distance _curTarget > 4 ) exitWith {closeDialog 0;}; // Prevents menu accessing from far distances.
  30. };
  31.  
  32. if (!dialog) then {
  33.     createDialog "pInteraction_Menu";
  34. };
  35.  
  36. _display = findDisplay 37400;
  37. _Btn1 = _display displayCtrl Btn1;
  38. _Btn2 = _display displayCtrl Btn2;
  39. _Btn3 = _display displayCtrl Btn3;
  40. _Btn4 = _display displayCtrl Btn4;
  41. _Btn5 = _display displayCtrl Btn5;
  42. _Btn6 = _display displayCtrl Btn6;
  43. _Btn7 = _display displayCtrl Btn7;
  44. _Btn8 = _display displayCtrl Btn8;
  45. life_pInact_curTarget = _curTarget;
  46.  
  47. switch (playerSide) do {
  48.     case west: {
  49.         if (player getVariable ["isEscorting",false]) then {
  50.             { _x ctrlShow false; } forEach [_Btn1,_Btn2,_Btn3,_Btn5,_Btn6,_Btn7,_Btn8];
  51.         };
  52.            
  53.         //Set Unrestrain Button
  54.         _Btn1 ctrlSetText localize "STR_pInAct_Unrestrain";
  55.         _Btn1 buttonSetAction "[life_pInact_curTarget] call life_fnc_unrestrain; closeDialog 0;";
  56.  
  57.         //Set Check Licenses Button
  58.         _Btn2 ctrlSetText localize "STR_pInAct_checkLicenses";
  59.         _Btn2 buttonSetAction "[player] remoteExecCall [""life_fnc_licenseCheck"",life_pInact_curTarget]; closeDialog 0;";
  60.  
  61.         //Set Search Button
  62.         _Btn3 ctrlSetText localize "STR_pInAct_SearchPlayer";
  63.         _Btn3 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_searchAction; closeDialog 0;";
  64.  
  65.         //Set Escort Button
  66.         if (player getVariable ["isEscorting",false]) then {
  67.             _Btn4 ctrlSetText localize "STR_pInAct_StopEscort";
  68.             _Btn4 buttonSetAction "[] call life_fnc_stopEscorting; closeDialog 0;";
  69.         } else {
  70.             _Btn4 ctrlSetText localize "STR_pInAct_Escort";
  71.             _Btn4 buttonSetAction "[life_pInact_curTarget] call life_fnc_escortAction; closeDialog 0;";
  72.         };
  73.  
  74.         //Set Ticket Button
  75.         _Btn5 ctrlSetText localize "STR_pInAct_TicketBtn";
  76.         _Btn5 buttonSetAction "[life_pInact_curTarget] call life_fnc_ticketAction;";
  77.  
  78.         _Btn6 ctrlSetText localize "STR_pInAct_Arrest";
  79.         _Btn6 buttonSetAction "[life_pInact_curTarget] call life_fnc_arrestAction; closeDialog 0;";
  80.         _Btn6 ctrlEnable false;
  81.  
  82.         _Btn7 ctrlSetText localize "STR_pInAct_PutInCar";
  83.         _Btn7 buttonSetAction "[life_pInact_curTarget] call life_fnc_putInCar; closeDialog 0;";
  84.  
  85.         //SeizeWeapons Button
  86.         _Btn8 ctrlSetText localize "STR_pInAct_Seize";
  87.         _Btn8 buttonSetAction "[life_pInact_curTarget] spawn life_fnc_seizePlayerAction; closeDialog 0;";
  88.  
  89.         if (FETCH_CONST(life_coplevel) < _seizeRank) then {_Btn8 ctrlEnable false;};
  90.  
  91.         {
  92.             if ((player distance (getMarkerPos _x) <30)) exitWith { _Btn6 ctrlEnable true;};
  93.         } forEach LIFE_SETTINGS(getArray,"sendtoJail_locations");
  94.  
  95.         _Btn9 ctrlSetText "Informations Permis";
  96.         _Btn9 buttonSetAction "[name life_pInact_curTarget,1] remoteExec ['max_permisPoints_fnc_getPermisInfo',2];";
  97.     };
  98.  
  99.     case civilian: {
  100.         if (player getVariable ["isEscorting",false]) then {
  101.             { _x ctrlShow false; } forEach [_Btn1,_Btn2,_Btn4,_Btn5,_Btn6];
  102.         };
  103.        
  104.         if (player getVariable ["isEscorting",false]) then {
  105.             _Btn3 ctrlSetText localize "STR_pInAct_StopEscort";
  106.             _Btn3 buttonSetAction "[] call life_fnc_stopEscorting; closeDialog 0;";
  107.         } else {
  108.             _Btn3 ctrlSetText localize "STR_pInAct_Escort";
  109.             _Btn3 buttonSetAction "[life_pInact_curTarget] call life_fnc_escortAction; closeDialog 0;";
  110.         };
  111.  
  112.         _Btn4 ctrlSetText localize "STR_pInAct_PutInCar";
  113.         _Btn4 buttonSetAction "[life_pInact_curTarget] call life_fnc_putInCar;";
  114.  
  115.         if ((_curTarget getVariable ["blindfolded", false])) then {
  116.             _Btn7 ctrlSetText "Enlever un sac";
  117.             _Btn7 buttonSetAction "[] call life_fnc_untieb; closeDialog 0;";
  118.         } else {
  119.             _Btn9 ctrlSetText "Mettre un sac";
  120.             _Btn9 buttonSetAction "[] call life_fnc_tieingActionb; closeDialog 0;";
  121.         };
  122.        
  123.         if ((_curTarget getVariable ["gagged", false])) then {
  124.             _Btn6 ctrlSetText "Débaillonner";
  125.             _Btn6 buttonSetAction "[] call life_fnc_removeGagAction; closeDialog 0;";
  126.         } else {
  127.             _Btn6 ctrlSetText "Baillonner";
  128.             _Btn6 buttonSetAction "[] call life_fnc_gagAction; closeDialog 0;";
  129.         };
  130.  
  131.         if (!(_curTarget getVariable ["tied", false])) then {
  132.             _Btn1 ctrlSetText "Menotter";
  133.             _Btn1 buttonSetAction "[] call life_fnc_tieingAction; closeDialog 0;";
  134.             _Btn2 ctrlEnable false;
  135.             _Btn3 ctrlEnable false;
  136.             _Btn4 ctrlEnable false;
  137.             _Btn5 ctrlEnable false;
  138.             _Btn6 ctrlEnable false;
  139.         } else {
  140.             _Btn1 ctrlSetText "Démenotter";
  141.             _Btn1 buttonSetAction "[] call life_fnc_untie; closeDialog 0;";
  142.         };
  143.        
  144.         if (player getVariable ["isEscorting",false]) then {
  145.             { _x ctrlShow false; } forEach [_Btn1,_Btn2,_Btn4,_Btn5,_Btn6];
  146.             _Btn3 ctrlEnable true;         
  147.         };
  148.  
  149.         _Btn7 ctrlShow false;
  150.         _Btn8 ctrlShow false;
  151.         _Btn9 ctrlShow false;
  152.     };
  153.     default {};
  154. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement