Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. /*
  2. File: fn_boltcutter.sqf
  3. Author: Bryan "Tonic" Boardwine
  4.  
  5. Description:
  6. Breaks the lock on a single door (Closet door to the player).
  7. */
  8. private["_building","_door","_doors","_cpRate","_title","_progressBar","_titleText","_cp","_ui","_Pos","_msg","_msgpos"];
  9. _building = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
  10. if(isNull _building) exitWith {};
  11. if(!(_building isKindOf "House_F")) exitWith {hint "You are not looking at a house door."};
  12. if(isNil "life_boltcutter_uses") then {life_boltcutter_uses = 0;};
  13. if((nearestObject [[16019.5,16952.9,0],"Land_Dome_Big_F"]) == _building OR (nearestObject [[16019.5,16952.9,0],"Land_Research_house_V1_F"]) == _building) then {
  14. [[[1,2],"STR_ISTR_Bolt_AlertFed",true,[]],"life_fnc_broadcast",true,false] spawn life_fnc_MP;
  15. [[_building],"life_fnc_bankAlarmSound",nil,true] spawn life_fnc_MP;
  16. } else {
  17. [[0,"STR_ISTR_Bolt_AlertHouse",true,[profileName]],"life_fnc_broadcast",true,false] spawn life_fnc_MP;
  18. if(_building getVariable["alarm",false]) then {
  19. _Pos = position player;
  20. _msg = "Alarm wegen unautorisierten Zugriff auf Haus ausgelöst.";
  21. _msgpos = format["%1, %2",_Pos select 0,_Pos select 1];
  22. [[_msg,_msgpos,8],"TON_fnc_clientMessage",west,false] spawn life_fnc_MP;
  23. /*
  24. _marker = createMarker ["Marker200", _Pos];
  25. "Marker200" setMarkerColor "ColorRed";
  26. "Marker200" setMarkerText "! HAUSEINBRUCH !";
  27. "Marker200" setMarkerType "mil_warning";
  28. //deleteMarker "Marker200";
  29. */
  30. [[_building],"life_fnc_houseAlarmSound",nil,true] spawn life_fnc_MP;
  31. };
  32. };
  33.  
  34. _doors = getNumber(configFile >> "CfgVehicles" >> (typeOf _building) >> "NumberOfDoors");
  35.  
  36. _door = 0;
  37. //Find the nearest door
  38. for "_i" from 1 to _doors do {
  39. _selPos = _building selectionPosition format["Door_%1_trigger",_i];
  40. _worldSpace = _building modelToWorld _selPos;
  41. if(player distance _worldSpace < 5) exitWith {_door = _i;};
  42. };
  43. if(_door == 0) exitWith {hint localize "STR_Cop_NotaDoor"}; //Not near a door to be broken into.
  44. if((_building getVariable[format["bis_disabled_Door_%1",_door],0]) == 0) exitWith {hint localize "STR_House_Raid_DoorUnlocked"};
  45. life_action_inUse = true;
  46.  
  47. //Setup the progress bar
  48. disableSerialization;
  49. _title = localize "STR_ISTR_Bolt_Process";
  50. 5 cutRsc ["life_progress","PLAIN"];
  51. _ui = uiNamespace getVariable "life_progress";
  52. _progressBar = _ui displayCtrl 38201;
  53. _titleText = _ui displayCtrl 38202;
  54. _titleText ctrlSetText format["%2 (1%1)...","%",_title];
  55. _progressBar progressSetPosition 0.01;
  56. _cP = 0.01;
  57.  
  58. switch (typeOf _building) do {
  59. case "Land_Dome_Big_F": {_cpRate = 0.003;};
  60. case "Land_Research_house_V1_F": {_cpRate = 0.0015;};
  61. default {_cpRate = 0.01;}
  62. };
  63.  
  64. while {true} do
  65. {
  66. if(animationState player != "AinvPknlMstpSnonWnonDnon_medic_1") then {
  67. [[player,"AinvPknlMstpSnonWnonDnon_medic_1"],"life_fnc_animSync",true,false] spawn life_fnc_MP;
  68. player playMoveNow "AinvPknlMstpSnonWnonDnon_medic_1";
  69. };
  70. sleep 0.26;
  71. if(isNull _ui) then {
  72. 5 cutRsc ["life_progress","PLAIN"];
  73. _ui = uiNamespace getVariable "life_progress";
  74. _progressBar = _ui displayCtrl 38201;
  75. _titleText = _ui displayCtrl 38202;
  76. };
  77. _cP = _cP + _cpRate;
  78. _progressBar progressSetPosition _cP;
  79. _titleText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_title];
  80. if(_cP >= 1 OR !alive player) exitWith {};
  81. if(life_istazed) exitWith {}; //Tazed
  82. if(life_isrubbered) exitWith {}; //Rubbered
  83. if(life_interrupted) exitWith {};
  84. };
  85.  
  86. //Kill the UI display and check for various states
  87. 5 cutText ["","PLAIN"];
  88. player playActionNow "stop";
  89. if(!alive player OR life_istazed OR life_isrubbered) exitWith {life_action_inUse = false;};
  90. if((player getVariable["restrained",false])) exitWith {life_action_inUse = false;};
  91. if(life_interrupted) exitWith {life_interrupted = false; titleText[localize "STR_NOTF_ActionCancel","PLAIN"]; life_action_inUse = false;};
  92. life_boltcutter_uses = life_boltcutter_uses + 1;
  93. life_action_inUse = false;
  94. if(life_boltcutter_uses >= 5) then {
  95. [false,"boltcutter",1] call life_fnc_handleInv;
  96. life_boltcutter_uses = 0;
  97. };
  98.  
  99. _building setVariable[format["bis_disabled_Door_%1",_door],0,true]; //Unlock the door.
  100. if((_building getVariable["locked",false])) then {
  101. _building setVariable["locked",false,true];
  102. };
  103. [[getPlayerUID player,profileName,"459"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement