Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. private ["_uiDisp","_time","_timer","_amt","_item","_cash","_cashRand","_reqItem","_perkTime"];
  3.  
  4. params [["_obj",objNull,[objNull]], ["_ply",objNull,[objNull]], "", ["_type","",[""]]];
  5.  
  6. _var = missionNamespace getVariable ["ArmaLife_MajorCrime",time];
  7. _formatTime = [(1800 - (ceil(serverTime - _var))), "MM", false] call BIS_fnc_secondsToString;
  8. if ((time - _var) < 1800) exitWith {[format["There has been a recent major crime, you must wait %1 more minutes.",_formatTime],true,"slow"] call ALSG_fnc_notificationSystem;};
  9.  
  10. if (isNull _obj) exitWith {};
  11. if (isNull _ply) exitWith {};
  12. if (_obj getVariable ["bankOpen",false]) exitWith {["Safe is already open!",true,"slow"] call ALSG_fnc_notificationSystem;};
  13. if (_obj getVariable ["chargeplaced",false]) exitWith {["Charge already placed.!",true,"slow"] call ALSG_fnc_notificationSystem;};
  14. if (_type isEqualTo "") exitWith {["A dev has been dumb, tell them it is the Action.",true,"slow"] call ALSG_fnc_notificationSystem;};
  15. if !(_ply isEqualTo player) exitWith {["You are not equal to yourself.",true,"slow"] call ALSG_fnc_notificationSystem;};
  16. if ((_ply distance _obj) > 10) exitWith {["Too far away",true,"slow"] call ALSG_fnc_notificationSystem;};
  17. if !(playerSide isEqualTo civilian) exitWith {["You need to be a civ?",true,"slow"] call ALSG_fnc_notificationSystem;};
  18. if ((west countSide playableUnits) < 7) exitWith {[ format ["There are %1 cop(s) online, 7 cops are needed." , (west countSide playableUnits)],true,"slow"] call ALSG_fnc_notificationSystem;};
  19.  
  20. _class = MAIN_SETTINGS("MajorCrimes",_type);
  21. if !(isClass _class) exitWith {["A dev has been dumb, tell them it is the config.",true,"slow"] call ALSG_fnc_notificationSystem;};
  22.  
  23. _reqItem = getText (_class >> "requiredItem");
  24. if(!([false,_reqItem,1,"major"] call ALSG_fnc_handleInv)) exitWith { [format ["You dont have a %1", localize (getText (missionConfigFile >> "VirtualItems" >> _reqItem >> "displayName"))],false,"slow"] call ALSG_fnc_notificationSystem; };
  25.  
  26. //_amt = getNumber (_class >> "amount");
  27.  
  28. life_major_amount = nil;
  29. [] remoteExecCall ["ArmaLife_TotalItems", 2];
  30. _time = time;
  31. waitUntil {!isNil "life_major_amount" || (time - _time) > 5};
  32.  
  33. if ((time - _time) > 5) then {
  34. life_major_amount = 6;
  35. } ;
  36.  
  37. _amt = life_major_amount;
  38. if (_amt > 17) then {
  39. _amt = 10;
  40. };
  41.  
  42. if (configName _class == "bank") then {
  43. _amt = ceil (_amt / 2);
  44. };
  45. _item = selectRandom (getArray (_class >> "items"));
  46.  
  47. _time = ((getNumber (_class >> "time") ));
  48. _perkTime = ((missionNamespace getVariable ["mav_ttm_var_robbingMultiplier", 1]) - 1);
  49. _time = _time - (_time * _perkTime);
  50. _time = _time + time;
  51.  
  52. [_type] remoteExec ['ALSG_fnc_AANBank',-2];
  53. missionNamespace setVariable ["ArmaLife_MajorCrime",time,true];
  54.  
  55. disableSerialization;
  56. "lifeTimer" cutRsc ["life_timer","PLAIN"];
  57. _uiDisp = uiNamespace getVariable "life_timer";
  58. _timer = _uiDisp displayCtrl 38301;
  59. _obj setVariable ["chargeplaced",true,true];
  60.  
  61. for "_i" from 0 to 1 step 0 do {
  62. if (isNull _uiDisp) then {
  63. "lifeTimer" cutRsc ["life_timer","PLAIN"];
  64. _uiDisp = uiNamespace getVariable "life_timer";
  65. _timer = _uiDisp displayCtrl 38301;
  66. };
  67. if (round(_time - time) < 1) exitWith {};
  68. if (!(_obj getVariable ["chargeplaced",false])) exitWith {};
  69. _timer ctrlSetText format ["%1",[(_time - time),"MM:SS.MS"] call BIS_fnc_secondsToString];
  70. sleep 0.08;
  71. };
  72. "lifeTimer" cutText["","PLAIN"];
  73. if (!(_obj getVariable ["chargeplaced",false])) exitWith {};
  74. _weight = ITEM_WEIGHT(_item);
  75. _totalweight = _weight * _amt;
  76.  
  77. _obj setVariable ["chargeplaced",false,true];
  78. _obj setVariable ["Trunk",[[[_item,_amt]],_totalweight],true];
  79. _obj setVariable ["bankOpen",true,true];
  80. _obj setVariable ["openInv",false,true];
  81. _obj setVariable ["openInvPID",nil,true];
  82. missionNamespace setVariable ["ArmaLife_MajorCrime",time,true];
  83.  
  84. ["Bo_GBU12_LGB_MI10",[getPosATL _obj select 0, getPosATL _obj select 1, (getPosATL _obj select 2)+0.5]] call ArmaLife_CreateVehicle;
  85. ["The safe has been opened got to it and press T to collect your earnings!",true,"slow"] call ALSG_fnc_notificationSystem;
  86.  
  87. switch (_type) do {
  88. case "Fed": {
  89. [true,"relicFed",1,"major"] call ALSG_fnc_handleInv;
  90.  
  91. if (!isNil {(group player) getVariable ["gang_name",""]}) then {
  92. _gangrole = (group player) getVariable ["gang_role",[]];
  93. if (_gangrole isEqualTo []) exitWith {};
  94.  
  95. _gangselect = _gangrole select 0;
  96. if (_gangselect != 0) then {
  97. _task = "Defunding the Cartel";
  98. _check = [_task,_gangselect] call ArmaLife_Lib_CheckTask;
  99. if (!_check) then {[_task] remoteExec ["ArmaLife_UnlockTask",2];};
  100. };
  101. };
  102. };
  103.  
  104. case "Bank": {
  105. if (!isNil {(group player) getVariable ["gang_name",""]}) then {
  106. _gangrole = (group player) getVariable ["gang_role",[]];
  107. if (_gangrole isEqualTo []) exitWith {};
  108.  
  109. _gangselect = _gangrole select 0;
  110. if (_gangselect != 0) then {
  111. _task = "Defunding the Mafia";
  112. _check = [_task,_gangselect] call ArmaLife_Lib_CheckTask;
  113. if (!_check) then {[_task] remoteExec ["ArmaLife_UnlockTask",2];};
  114. };
  115. };
  116. };
  117.  
  118. case "Casino": {};
  119. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement