Advertisement
Guest User

Untitled

a guest
Nov 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 4.34 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2.  
  3. private["_time","_count","_building","_door","_cpRate","_title","_progressBar","_titleText","_cp","_ui","_pos","_marker","_insz","_uid","_ownerRet","_progress_rscLayer","_error","_isFed","_time","_count"];
  4. _count = "cop" call life_fnc_countRole;
  5. if(_count < 5)exitWith{hint"Для взлома системы безопасности необходимо присутствие 5 полицейских";};
  6. _time = _count * 60;
  7. life_interrupted = false;
  8. if(player call life_fnc_getRole != "civ")exitWith{};
  9. if(player GVAR ["isArrested",false])exitWith{};
  10. _building = nearestObject [player, "Land_MainSection"];
  11. _block = nearestObject [player, "Land_PowerGenerator_F"];
  12. if(isNull _building OR !(_building isKindOf "Land_MainSection")) exitWith {};
  13. if(isNull _block OR !(_block isKindOf "Land_PowerGenerator_F")) exitWith {};
  14. if(_block GVAR ["inProcess",false])exitWith {hint"Уже кем то используется"};
  15. if((life_istazed) or (life_isknocked) or !(alive player) or (player GVAR ["restrained",false]))exitWith {}; //Tazed
  16. _lastTime = _building GVAR ["time",0];
  17. if(_lastTime != 0 && {(time - _lastTime) < (30*60)})exitWith{hint"С момента последнего взлома не прошло 60 минут, это опасно"};
  18. [[1,2],"STR_ISTR_Bolt_AlertPrison",true,[]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  19. //поехали? ..... в западло выделять в отдельный файл может потом как-нибудь наведу порядок.
  20. [_building,_block,_time]spawn{
  21.     private["_time","_building","_door","_cpRate","_title","_progressBar","_titleText","_cp","_ui","_pos","_marker","_insz","_uid","_ownerRet","_progress_rscLayer","_error","_isFed","_prisonDoors1","_prisonDoors2"];
  22.     _building = param [0,ObjNull,[ObjNull]];
  23.     _block = param [1,ObjNull,[ObjNull]];
  24.     _time = param [2,120,[120]];
  25.     _error = false;
  26.     life_action_inUse = true;
  27.     _prisonDoors1 = ["Door1","Door2","Door3","Door4","Door5","Door6","Door7","Door8","Door9","Door10","Door11","Door12","Door13","Door14","S1","S2","S3","S4","S5","S6","S7"];// 1- открыть; 0 - закрыть
  28.     _prisonDoors2 = ["A1","A2","A3","A4","A5","A6","A7","A8","A9","A10","A11","A12","B1","B2","B3","B4","B5","B6","B7","B8","B9","B10","B11","B12","C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","D1","D2","D3","D4","D5","D6","D7","D8","D9","D10","D11","D12"];// -1- открыть; 0 - закрыть
  29.     _block SVAR ["inProcess",true,true];
  30.     disableSerialization;
  31.    
  32.     _time = gen_timer_prisonSecurity;
  33.     if (call life_donator) then {_time = _time * 0.5};
  34.     _startTime = time;
  35.     _endTime = _startTime + _time;
  36.     _error = false;
  37.     _check = {
  38.         if(_this)then{
  39.             !alive player OR !(NOTINVEH(player)) OR player GVAR ["tazed",false] OR life_interrupted OR player getVariable["restrained",false] OR LSINCAP(player)
  40.         }else{
  41.             !alive player OR !(NOTINVEH(player)) OR player GVAR ["tazed",false] OR player getVariable["restrained",false] OR LSINCAP(player)
  42.         };
  43.     };
  44.     waitUntil{
  45.         _progress = floor linearConversion[ _startTime, _endTime, time, 0, 24 ];
  46.         [_progress] call life_fnc_progressBar;
  47.         if !(ISANIMSTATE("ainvpknlmstpsnonwnondnon_medic_1")) then {
  48.             [player,"ainvpknlmstpsnonwnondnon_medic_1"] remoteExecCall ["life_fnc_animSync",0];
  49.         };
  50.         if(true call _check) exitWith {_error = true;true};
  51.         if(time > _endTime) exitWith {true};
  52.         uiSleep 1;
  53.     };
  54.     player playActionNow "stop";
  55.     ("life_progress" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
  56.     life_action_inUse = false;
  57.     if (LSINCAP(player)) exitWith {[player] call life_fnc_setDeadState};
  58.     if(_error) exitWith {systemChat "Действие прервано."};
  59.  
  60.     if(random(100) < 80) then {
  61.         titleText["Вы взломали ситему безопасности тюрьмы, все двери открыты","PLAIN"];
  62.         {
  63.             _building animate [format["%1",_X],1];
  64.         }foreach _prisonDoors1;
  65.         {
  66.             _building animate [format["%1",_X],-1];
  67.         }foreach _prisonDoors2;
  68.         _building SVAR ["time",time,true];
  69.         [_time] remoteExecCall ["life_fnc_GoBabyGo",RCLIENT];
  70.         sleep _time;
  71.         {
  72.             _building animate [format["%1",_X],0];
  73.         }foreach _prisonDoors1;
  74.         {
  75.             _building animate [format["%1",_X],0];
  76.         }foreach _prisonDoors2;
  77.     }else{
  78.         titleText["Вам не удалось взломать ситему безопасности тюрьмы...","PLAIN"];
  79.     };
  80. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement