Advertisement
Guest User

player_remove

a guest
May 23rd, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.87 KB | None | 0 0
  1. private["_playerPos","_adminRemoval","_authorizedGateCodes","_authorizedUID","_authorizedOUID","_authorizedPUID","_playerNearby","_func_ownerRemove","_qtyE","_qtyCr","_qtyC","_qtyB","_qtySt","_qtyDT","_qtyS","_qtyW","_qtyL","_qtyM","_qtyG","_qtyT","_removable","_eTool","_result","_building","_dialog","_classname","_requirements","_objectID","_objectUID","_obj","_cnt","_id","_tblProb","_locationPlayer","_randNum2","_smallWloop","_medWloop","_longWloop","_wait","_longWait","_medWait","_highP","_medP","_lowP","_failRemove","_canRemove","_randNum","_text","_dir","_pos","_isWater","_inVehicle","_onLadder","_hasToolbox","_canDo","_hasEtool"];
  2. disableserialization;
  3. remProc = true;
  4. player removeAction s_player_deleteCamoNet;
  5. s_player_deleteCamoNet = -1;
  6. player removeAction s_player_deleteBuild;
  7. s_player_deleteBuild = -1;
  8. player removeAction s_player_removeFlag;
  9. s_player_removeFlag = -1;
  10. player removeAction s_player_deleteLightTower;
  11. s_player_deleteLightTower = -1;
  12. _obj = objNull;
  13. _obj = _this select 3;
  14. if (_obj isKindof "Grave") then {
  15. _text = "Bomb";
  16. cutText [format["You can only disarm %1 to remove it",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit";
  17. };
  18. // Get ObjectID or UID
  19. if (!isNull _obj) then {
  20. _objectID = _obj getVariable["ObjectID","0"];
  21. _authorizedUID = _obj getVariable ["AuthorizedUID", []]; //Retrieve the object's stored array
  22. _authorizedOUID = (_authorizedUID select 0) select 0; //Get the objectUID from the array so it doesn't miscalculate
  23. };
  24. // Anti dupe
  25. _playerNearby = (nearestObjects [player, ["AllPlayers","CAManBase"], 12] select 0);
  26. if (!isNull _playerNearby && _playerNearby distance player <= 10 && _playerNearby != player && isPlayer _playerNearby && alive _playerNearby) exitwith
  27. {
  28. cutText ["Other players need to be > 10 meters away to remove object", "PLAIN DOWN"];
  29. remProc = false;
  30. };
  31. _ownerID = _obj getVariable ["characterID","0"];
  32. // Pre-Checks
  33. _dir = direction _obj;
  34. _pos = getposATL _obj;
  35. _locationPlayer = player modeltoworld [0,0,0];
  36. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  37. _isWater = (surfaceIsWater _locationPlayer) or dayz_isSwimming;
  38. _inVehicle = (vehicle player != player);
  39. _building = nearestObject [player, "Building"];
  40. _onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  41. _hasToolbox = "ItemToolbox" in items player;
  42. _canDo = (!r_drag_sqf and !r_player_unconscious and !_onLadder); //USE!!
  43. _hasEtool = "ItemEtool" in weapons player;
  44. _authorizedUID = _obj getVariable ["AuthorizedUID", []];
  45. _authorizedPUID = _authorizedUID select 1; //Defines only the second element of the array which contains playerUIDs
  46. _authorizedGateCodes = ((getPlayerUid player) in _authorizedPUID);
  47. _adminRemoval = ((getPlayerUID player) in BBSuperAdminAccess || (getPlayerUID player) in BBLowerAdminAccess);
  48. _flagRadius = BBFlagRadius;
  49.  
  50. //Booleans
  51. _canRemove = false;
  52. _failRemove = false;
  53. _result = false;
  54. adminChooses = false;
  55. adminRemoval = false;
  56.  
  57. //Integers
  58. _longWloop = 6; // time to remove object * 10 = time in seconds. 6 = 60 seconds
  59. _medWloop = 4;
  60. _smallWloop = 3;
  61. _tblProb = BBtblProb;
  62. _lowP = BBlowP;
  63. _medP = BBmedP;
  64. _highP = BBhighP;
  65. _cnt = 0;
  66. _wait = 10;
  67.  
  68. _qtyT = 0;
  69. _qtyS = 0; //144752844454260
  70. _qtyW = 0;
  71. _qtyL = 0;
  72. _qtyM = 0;
  73. _qtyG = 0;
  74. _qtyE = 0;
  75. _qtyCr = 0;
  76. _qtyC = 0;
  77. _qtyB = 0;
  78. _qtySt = 0;
  79. _qtyDT = 0;
  80. // Do percentages
  81. _randNum = round(random 100);
  82. _randNum2 = round(random 100);
  83.  
  84. //Others
  85. if(_isWater) then {cutText [localize "str_player_26", "PLAIN DOWN"];remProc = false;breakOut "exit";};
  86. if(_onLadder) then {cutText [localize "str_player_21", "PLAIN DOWN"];remProc = false;breakOut "exit";};
  87. if (_inVehicle) then {cutText [localize "Can't do this in vehicle", "PLAIN DOWN"];remProc = false;breakOut "exit";};
  88.  
  89. // This function is for owner removal either by code (line 109) or by ownerID (line 112)
  90. _func_ownerRemove = {
  91.  
  92. for "_i" from 0 to ((count allbuildables) - 1) do
  93. {
  94. _classname = (allbuildables select _i) select _i - _i + 1;
  95. _result = [typeOf(_obj),_classname] call BIS_fnc_areEqual;
  96. if (_result) exitwith {
  97. _recipe = (allbuildables select _i) select _i - _i;
  98. //[_qtyT, _qtyS, _qtyW, _qtyL, _qtyM, _qtyG]
  99. _qtyT = _recipe select 0;
  100. _qtyS = _recipe select 1;
  101. _qtyW = _recipe select 2;
  102. _qtyL = _recipe select 3;
  103. _qtyM = _recipe select 4;
  104. _qtyG = _recipe select 5;
  105. _qtyE= _recipe select 6;
  106. _qtyCr= _recipe select 7;
  107. _qtyC= _recipe select 8;
  108. _qtyB= _recipe select 9;
  109. _qtySt= _recipe select 10;
  110. _qtyDT = _recipe select 11;
  111. };
  112. };
  113. if (_qtyT > 0) then {
  114. for "_i" from 1 to _qtyT do { _result = [player,"ItemTankTrap"] call BIS_fnc_invAdd; };
  115. };
  116. if (_qtyS > 0) then {
  117. for "_i" from 1 to _qtyS do { _result = [player,"ItemSandbag"] call BIS_fnc_invAdd; };
  118. };
  119. if (_qtyW > 0) then {
  120. for "_i" from 1 to _qtyW do { _result = [player,"ItemWire"] call BIS_fnc_invAdd; };
  121. };
  122. if (_qtyL > 0) then {
  123. for "_i" from 1 to _qtyL do { _result = [player,"PartWoodPile"] call BIS_fnc_invAdd; };
  124. };
  125. if (_qtyM > 0) then {
  126. for "_i" from 1 to _qtyM do { _result = [player,"PartGeneric"] call BIS_fnc_invAdd; };
  127. };
  128. if (_qtyG > 0) then {
  129. for "_i" from 1 to _qtyG do { _result = [player,"HandGrenade_west"] call BIS_fnc_invAdd; };
  130. };
  131. if (_qtyE > 0) then {
  132. for "_i" from 1 to _qtyE do { _result = [player,"equip_scrapelectronics"] call BIS_fnc_invAdd; };
  133. };
  134. if (_qtyCr > 0) then {
  135. for "_i" from 1 to _qtyCr do { _result = [player,"equip_crate"] call BIS_fnc_invAdd; };
  136. };
  137. if (_qtyC > 0) then {
  138. for "_i" from 1 to _qtyC do { _result = [player,"ItemCamoNet"] call BIS_fnc_invAdd; };
  139. };
  140. if (_qtyB > 0) then {
  141. for "_i" from 1 to _qtyB do { _result = [player,"equip_brick"] call BIS_fnc_invAdd; };
  142. };
  143. if (_qtySt > 0) then {
  144. for "_i" from 1 to _qtySt do { _result = [player,"equip_string"] call BIS_fnc_invAdd; };
  145. };
  146. if (_qtyDT > 0) then {
  147. for "_i" from 1 to _qtyDT do { _result = [player,"equip_duct_tape"] call BIS_fnc_invAdd; };
  148. };
  149. cutText [format["Owner refunded for object %1",typeof(_obj)], "PLAIN DOWN",1];
  150. PVDZ_obj_Delete = [_objectID,_authorizedOUID];
  151. publicVariableServer "PVDZ_obj_Delete";
  152. if (isServer) then {
  153. PVDZ_obj_Delete call server_deleteObj;
  154. };
  155. deletevehicle _obj;
  156. remProc = false;
  157. breakout "exit";
  158. };
  159.  
  160.  
  161. //Admin remove option
  162. if (_adminRemoval) then {
  163. s_admin_removal = player addAction ["ADMIN: Removal(Logged)", "dayz_code\actions\adminActions\admin_removal.sqf",_obj, 1, true, true, "", ""];
  164. s_normal_removal = player addAction ["ADMIN: Normal Removal", "dayz_code\actions\adminActions\normal_removal.sqf",_obj, 1, true, true, "", ""];
  165. waitUntil {adminChooses};
  166. player removeaction s_normal_removal;
  167. player removeaction s_admin_removal;
  168. s_normal_removal = -1;
  169. s_admin_removal = -1;
  170. if (adminRemoval) exitWith {
  171. call _func_ownerRemove;
  172. };
  173. };
  174.  
  175. // Flag removal special
  176. if (typeOf(_obj) == BBTypeOfFlag && (_authorizedGateCodes)) then {
  177. _baseObjects = nearestObjects [_obj, allbuildables_class, BBFlagRadius];
  178. if (count _baseObjects > 1) then { //Flags count as an item so we have to check for >1
  179. cutText [format["You need to remove all existing base objects in %1 meters in order to move your base and delete your base flagpole",_flagRadius], "PLAIN DOWN",1];
  180. remProc = false;
  181. breakOut "exit";
  182. };
  183. };
  184.  
  185. //Owner ID or PlayerUID removal
  186. _playerPos = getPosATL player;
  187. if (_authorizedGateCodes) then {
  188. _cnt = 5;
  189. while {true} do {
  190. cutText [format["Removing object %1 in %2 seconds.\nMove position to cancel",typeOf(_obj), _cnt], "PLAIN DOWN",1];
  191.  
  192. if ((getposATL player) distance _playerPos > 1) exitWith {
  193. cutText [format["You moved and canceled build for %1", typeOf(_obj)], "PLAIN DOWN",1];
  194. remProc = false;
  195. breakOut "exit";
  196. };
  197. if (_cnt <= 0) exitwith {call _func_ownerRemove;};
  198. sleep 1;
  199. _cnt = _cnt - 1;
  200. };
  201. };
  202.  
  203. remProc = true;
  204. // Check what object is returned from global array, then return classname
  205. for "_i" from 0 to ((count allbuildables) - 1) do
  206. {
  207. _classname = (allbuildables select _i) select _i - _i + 1;
  208. _result = [typeOf(_obj),_classname] call BIS_fnc_areEqual;
  209. if (_result) exitWith {
  210. //_text = _classname;
  211. _text = getText (configFile >> "CfgVehicles" >> typeOf(_obj) >> "displayName");
  212. _requirements = (allbuildables select _i) select _i - _i + 2;
  213. };
  214. };
  215. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  216.  
  217. //Get Requirements from build_list.sqf global array [_attachCoords, _startPos, _modDir, _toolBox, _eTool, _medWait, _longWait, _inBuilding, _roadAllowed, _inTown];
  218. _eTool = _requirements select 4;
  219. _medWait = _requirements select 5;
  220. _longWait = _requirements select 6;
  221. _removable = _requirements select 10;
  222. if (!_removable) then {cutText [format["%1 is not allowed to be removed!",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  223. switch (true) do
  224. {
  225. player setVariable["startcombattimer", 1]; // Makes it harder for them to relog and keep their toolbox
  226. case(_longWait):
  227. {
  228. if (_eTool) then {
  229. if (!_hasEtool) then {cutText [format["You need an entrenching tool to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  230. };
  231. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  232. if (_randNum > _highP) then {_tblProb = _tblProb + 40;_canRemove = true;} else {_tblProb = _tblProb + 40;_failRemove = true;_longWait = true; };
  233. };
  234. case(_medWait):
  235. {
  236. if (_eTool) then {
  237. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  238. };
  239. if (!_hasEtool) then {cutText [format["You need an entrenching tool to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  240. if (_randNum > _medP) then {_tblProb = _tblProb + 20;_canRemove = true;} else {_tblProb = _tblProb + 20; _failRemove = true; _medWait = true;};
  241. };
  242. case(!_medWait && !_longWait):
  243. {
  244. if (_eTool) then {
  245. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  246. };
  247. if (!_hasEtool) then {cutText [format["You need an entrenching tool to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  248. if (_randNum > _lowP) then {_canRemove = true;} else { _failRemove = true;};
  249. };
  250. };
  251.  
  252.  
  253. //BuiltItems = ["Land_CncBlock","Land_ladder_half","Land_prebehlavka","Misc_cargo_cont_small_EP1","Land_fort_rampart_EP1","Hhedgehog_concrete","Land_ladder_half","Land_A_Castle_Stairs_A","Ins_WarfareBContructionSite","Misc_Cargo1Bo_military","Land_Misc_Cargo2E","Barrack2","Land_rails_bridge_40","Land_HBarrier1","Land_BagFenceRound","Land_fortified_nest_small","Land_HBarrier_large","Base_WarfareBBarrier10x","bunkerMedium02","Base_WarfareBBarrier10xTall","Land_Fort_Watchtower","Land_fortified_net_big","Fence_Ind","Fort_RazorWire","Land_podlejzacka","Land_camoNet_Nato","Land_camoNetB_Nato","Land_camoNetVar_Nato"];
  254.  
  255. switch (true) do
  256. {
  257. case(_longWait && _canRemove):
  258. {
  259. _cnt = _longWloop;
  260. _cnt = _cnt * 10;
  261. for "_i" from 0 to _longWloop do
  262. {
  263. cutText [format["Attempting to deconstruct %1 %2 seconds left. \nMove from current position to cancel\n %3 percent chance to fail, %4 percent chance to lose toolbox",_text,_cnt + 10,_highP,_tblProb], "PLAIN DOWN",1];
  264. if (player distance _locationPlayer > 0.2) then {cutText [format["Removal canceled for %1, position of player moved",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  265. if (!_canDo || _onLadder || _inVehicle) then {cutText [format["Removal canceled for %1, player is unable to continue",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  266. player playActionNow "Medic";
  267. _dialog = findDisplay 106;
  268. sleep 1;
  269. [player,"repair",0,false] call dayz_zombieSpeak;
  270. _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
  271. sleep _wait;
  272. _hasToolbox = "ItemToolbox" in items player;
  273. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  274. if (!(isNull _dialog)) then {cutText [format["Removal canceled for %1, you opened your gear menu.",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  275. _cnt = _cnt - 10;
  276. };
  277. _hasToolbox = "ItemToolbox" in items player;
  278. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  279. if (!isNull _obj && _randNum2 < _tblProb) then {player removeWeapon "ItemToolbox"; cutText ["Your toolbox was used up!", "PLAIN DOWN"];};
  280. sleep 1.5;
  281. };
  282. case(_medWait && _canRemove):
  283. {
  284. _cnt = _medWloop;
  285. _cnt = _cnt * 10;
  286. for "_i" from 0 to _medWloop do
  287. {
  288. cutText [format["Attempting to deconstruct %1 %2 seconds left. \nMove from current position to cancel\n %3 percent chance to fail, %4 percent chance to lose toolbox",_text,_cnt + 10,_medP,_tblProb], "PLAIN DOWN",1];
  289. if (player distance _locationPlayer > 0.2) then {cutText [format["Removal canceled for %1, position of player moved",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  290. if (!_canDo || _onLadder || _inVehicle) then {cutText [format["Removal canceled for %1, player is unable to continue",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  291. player playActionNow "Medic";
  292. _dialog = findDisplay 106;
  293. sleep 1;
  294. [player,"repair",0,false] call dayz_zombieSpeak;
  295. _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
  296. sleep _wait;
  297. _hasToolbox = "ItemToolbox" in items player;
  298. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  299. if (!(isNull _dialog)) then {cutText [format["Removal canceled for %1, you opened your gear menu.",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  300. _cnt = _cnt - 10;
  301. };
  302. _hasToolbox = "ItemToolbox" in items player;
  303. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  304. if (!isNull _obj && _randNum2 < _tblProb) then { player setVariable["startcombattimer", 1]; player removeWeapon "ItemToolbox"; cutText ["Your toolbox was used up!", "PLAIN DOWN"];};
  305. sleep 1.5;
  306. };
  307. case((!_medWait && !_longWait) && _canRemove):
  308. {
  309. _cnt = _smallWloop;
  310. _cnt = _cnt * 10;
  311. for "_i" from 0 to _smallWloop do
  312. {
  313. cutText [format["Attempting to deconstruct %1 %2 seconds left. \nMove from current position to cancel\n %3 percent chance to fail, %4 percent chance to lose toolbox",_text,_cnt + 10,_lowP,_tblProb], "PLAIN DOWN",1];
  314. if (player distance _locationPlayer > 0.2) then {cutText [format["Removal canceled for %1, position of player moved",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  315. if (!_canDo || _onLadder || _inVehicle) then {cutText [format["Removal canceled for %1, player is unable to continue",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  316. player playActionNow "Medic";
  317. _dialog = findDisplay 106;
  318. sleep 1;
  319. [player,"repair",0,false] call dayz_zombieSpeak;
  320. _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
  321. sleep _wait;
  322. _hasToolbox = "ItemToolbox" in items player;
  323. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  324. if (!(isNull _dialog)) then {cutText [format["Removal canceled for %1, you opened your gear menu.",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  325. _cnt = _cnt - 10;
  326. };
  327. _hasToolbox = "ItemToolbox" in items player;
  328. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  329. if (!isNull _obj && _randNum2 < _tblProb) then { player setVariable["startcombattimer", 1]; player removeWeapon "ItemToolbox"; cutText ["Your toolbox was used up!", "PLAIN DOWN"];};
  330. sleep 1.5;
  331. };
  332. case(_longWait && _failRemove):
  333. {
  334. _cnt = _longWloop;
  335. _cnt = _cnt * 10;
  336. for "_i" from 0 to _longWloop do
  337. {
  338. cutText [format["Attempting to deconstruct %1 %2 seconds left. \nMove from current position to cancel\n %3 percent chance to fail, %4 percent chance to lose toolbox",_text,_cnt + 10,_highP,_tblProb], "PLAIN DOWN",1];
  339. if (player distance _locationPlayer > 0.2) then {cutText [format["Removal canceled for %1, position of player moved",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  340. if (!_canDo || _onLadder || _inVehicle) then {cutText [format["Removal canceled for %1, player is unable to continue",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  341. player playActionNow "Medic";
  342. _dialog = findDisplay 106;
  343. sleep 1;
  344. [player,"repair",0,false] call dayz_zombieSpeak;
  345. _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
  346. sleep _wait;
  347. _hasToolbox = "ItemToolbox" in items player;
  348. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  349. if (!(isNull _dialog)) then {cutText [format["Removal canceled for %1, you opened your gear menu.",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  350. _cnt = _cnt - 10;
  351. };
  352. _hasToolbox = "ItemToolbox" in items player;
  353. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  354. if (!isNull _obj && _randNum2 < _tblProb) then { player setVariable["startcombattimer", 1]; player removeWeapon "ItemToolbox"; cutText ["Your toolbox was used up!", "PLAIN DOWN"];};
  355. sleep 1.5;
  356. cutText [format["You failed to remove %1!",_text], "PLAIN DOWN",6]; remProc = false; breakOut "exit";
  357. };
  358. case(_medWait && _failRemove):
  359. {
  360. _cnt = _medWloop;
  361. _cnt = _cnt * 10;
  362. for "_i" from 0 to _medWloop do
  363. {
  364. cutText [format["Attempting to deconstruct %1 %2 seconds left. \nMove from current position to cancel\n %3 percent chance to fail, %4 percent chance to lose toolbox",_text,_cnt + 10,_medP,_tblProb], "PLAIN DOWN",1];
  365. if (player distance _locationPlayer > 0.2) then {cutText [format["Removal canceled for %1, position of player moved",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  366. if (!_canDo || _onLadder || _inVehicle) then {cutText [format["Removal canceled for %1, player is unable to continue",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  367. player playActionNow "Medic";
  368. _dialog = findDisplay 106;
  369. sleep 1;
  370. [player,"repair",0,false] call dayz_zombieSpeak;
  371. _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
  372. sleep _wait;
  373. _hasToolbox = "ItemToolbox" in items player;
  374. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  375. if (!(isNull _dialog)) then {cutText [format["Removal canceled for %1, you opened your gear menu.",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  376. _cnt = _cnt - 10;
  377. };
  378. _hasToolbox = "ItemToolbox" in items player;
  379. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  380. if (!isNull _obj && _randNum2 < _tblProb) then { player setVariable["startcombattimer", 1]; player removeWeapon "ItemToolbox"; cutText ["Your toolbox was used up!", "PLAIN DOWN"];};
  381. sleep 1.5;
  382. cutText [format["You failed to remove %1!",_text], "PLAIN DOWN",6]; remProc = false; breakOut "exit";
  383. };
  384. case((!_medWait && !_longWait) && _failRemove):
  385. {
  386. _cnt = _smallWloop;
  387. _cnt = _cnt * 10;
  388. for "_i" from 0 to _smallWloop do
  389. {
  390. cutText [format["Attempting to deconstruct %1 %2 seconds left. \nMove from current position to cancel\n %3 percent chance to fail, %4 percent chance to lose toolbox",_text,_cnt + 10,_lowP,_tblProb], "PLAIN DOWN",1];
  391. if (player distance _locationPlayer > 0.2) then {cutText [format["Removal canceled for %1, position of player moved",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  392. if (!_canDo || _onLadder || _inVehicle) then {cutText [format["Removal canceled for %1, player is unable to continue",_text], "PLAIN DOWN",1]; remProc = false; breakOut "exit";};
  393. player playActionNow "Medic";
  394. _dialog = findDisplay 106;
  395. sleep 1;
  396. [player,"repair",0,false] call dayz_zombieSpeak;
  397. _id = [player,50,true,(getPosATL player)] spawn player_alertZombies;
  398. sleep _wait;
  399. _hasToolbox = "ItemToolbox" in items player;
  400. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  401. if (!(isNull _dialog)) then {cutText [format["Removal canceled for %1, you opened your gear menu.",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  402. _cnt = _cnt - 10;
  403. };
  404. _hasToolbox = "ItemToolbox" in items player;
  405. if (!_hasToolbox) then {cutText [format["You need a tool box to remove %1",_text], "PLAIN DOWN",1];remProc = false; breakOut "exit"; };
  406. if (!isNull _obj && _randNum2 < _tblProb) then { player setVariable["startcombattimer", 1]; player removeWeapon "ItemToolbox"; cutText ["Your toolbox was used up!", "PLAIN DOWN"];};
  407. sleep 1.5;
  408. cutText [format["You failed to remove %1!",_text], "PLAIN DOWN",6]; remProc = false; breakOut "exit";
  409. };
  410.  
  411. };
  412.  
  413. //Player removes object successfully
  414. if (!isNull _obj) then {
  415. cutText [format["You removed a %1 successfully!",_text], "PLAIN DOWN"];
  416. PVDZ_obj_Delete = [_objectID,_authorizedOUID];
  417. publicVariableServer "PVDZ_obj_Delete";
  418. if (isServer) then {
  419. PVDZ_obj_Delete call server_deleteObj;
  420. };
  421. player setVariable["startcombattimer", 1];
  422. sleep .1;
  423. deleteVehicle _obj;
  424. };
  425. remProc = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement