InnovativeStudios

fn_hackLaptop.sqf

Apr 30th, 2022 (edited)
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.67 KB | None | 0 0
  1. /*
  2.     filename: @fn_hackLaptop.sqf
  3.     Author: J. Schmidt
  4.     Coded for SOG Missions and Campaigns
  5.  
  6. */
  7.  
  8. params ["_laptop"];
  9.  
  10. if (_laptop getVariable ["inUse", false]) exitWith { hint "Someone is Already Downloading the Files." };
  11.  
  12. _laptop setVariable ["inUse", true, true];
  13. hackComplete = false;
  14. _ld0 = getUnitLoadout player;
  15. _backupLoadout = _ld0;
  16.  
  17. _ld1 = getUnitLoadout player;
  18. for "_i" from 0 to 2 do {
  19.     _ld1 set [_i, []];
  20. };
  21.  
  22. player setUnitLoadout _ld1;
  23. player switchMove "acts_accessing_computer_in";
  24. player playMoveNow "acts_accessing_computer_loop";
  25.  
  26. with uiNamespace do {
  27.     jas92_progressBar = findDisplay 46 ctrlCreate ["RscProgress", -1];
  28.     jas92_progressBar ctrlSetPosition [ 0.345, 0.3 ];
  29.     jas92_progressBar progressSetPosition 0;
  30.     jas92_progressBar ctrlCommit 0;
  31.     jas92_text = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
  32.     jas92_text ctrlSetPosition [ 0.345, 0.2925 ];
  33.     jas92_text ctrlCommit 0;
  34. };
  35.  
  36. ["timer", "onEachFrame", {
  37.     params ["_start", "_end", "_backupLoadout"];
  38.  
  39.     _progress = linearConversion[_start, _end, time, 0, 1];
  40.  
  41.     (uiNamespace getVariable "jas92_progressBar") progressSetPosition _progress;
  42.     (uiNamespace getVariable "jas92_text") ctrlSetStructuredText parseText format["%1%2", round(100 * _progress), "%"];
  43.  
  44.     if (_progress > 1) then {
  45.         [ "timer", "onEachFrame" ] call BIS_fnc_removeStackedEventHandler;
  46.         ctrlDelete (uiNamespace getVariable "jas92_progressBar");
  47.         ctrlDelete (uiNamespace getVariable "jas92_text");
  48.  
  49.         player playMoveNow "acts_accessing_computer_out_short";
  50.         player setUnitLoadout _backupLoadout;
  51.        
  52.         hackComplete = true;
  53.     };
  54. }, [time, time + 30, _backupLoadout]] call BIS_fnc_addStackedEventHandler;
Add Comment
Please, Sign In to add comment