Guest User

Bank Robbery Script

a guest
Aug 14th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.84 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_robBank.sqf
  4. Author: IDK
  5.  
  6. Description:
  7. For robbing bank
  8. */
  9. private["_robber","_shop","_kassa","_ui","_progress","_pgText","_cP","_rip","_Pos","_rndmrk","_mrkstring","_bankReward","_reward","_vault"];
  10.  
  11. _shop = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param; //The object that has the action attached to it is _this. ,0, is the index of object, ObjNull is the default should there be nothing in the parameter or it's broken
  12. _robber = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_param; //Can you guess? Alright, it's the player, or the "caller". The object is 0, the person activating the object is 1
  13. _action = [_this,2] call BIS_fnc_param;//Action name
  14. _cops = (west countSide playableUnits);
  15. _vault = param [0,ObjNull,[ObjNull]];
  16. if(typeOf _vault == "Land_CargoBox_V1_F" && time - (bank_bank getVariable ["reset",time]) < 3200) exitWith {hint "The bank was recently robbed!";};
  17. if(_cops < 5) exitWith {["You cannot rob bank, 5 or more police need to be on",false,"slow"] call life_fnc_notificationSystem;};
  18. if(side _robber isEqualTo west) exitWith { ["What do you think you are doing?",false,"slow"] call life_fnc_notificationSystem; };
  19. if(side _robber isEqualTo independent) exitWith { ["What do you think you are doing?",false,"slow"] call life_fnc_notificationSystem; };
  20. if(_robber distance _shop > 25) exitWith { ["You need to be within 25 meters to rob this shop!",false,"slow"] call life_fnc_notificationSystem; };
  21. if (vehicle player != _robber) exitWith { ["Get out of your car!",false,"slow"] call life_fnc_notificationSystem; };
  22. if !(alive _robber) exitWith {};
  23.  
  24. if(!([false,"codeCracker",1] call life_fnc_handleInv)) exitWith { ["You dont have a code Cracker",false,"slow"] call life_fnc_notificationSystem; };
  25.  
  26. //Caculate Money To Give
  27. _copMoney = 2000000;
  28. //(west countSide playableUnits) * 15000;
  29. //if (_copMoney > 750000) then {_copMoney = 750000;};
  30. //if (_copMoney < 75000) then {_copMoney = 75000;};
  31. _kassa = _copmoney + round(random 50000);
  32.  
  33. life_inv_codeCracker = life_inv_codeCracker - 1;
  34.  
  35. [1,format["ALARM! - %1 Robbery in progress", _shop]] remoteExec ["life_fnc_broadcast",west];
  36. remoteExec ['life_fnc_AAN_Bank2',-2];
  37. disableSerialization;
  38. 5 cutRsc ["life_progress","PLAIN"];
  39. _ui = uiNameSpace getVariable "life_progress";
  40. _progress = _ui displayCtrl 38201;
  41. _pgText = _ui displayCtrl 38202;
  42. _pgText ctrlSetText format["Robbing, empty your inventory for gold bars, stay within 25 meters (1%1)...","%"];
  43. _progress progressSetPosition 0.01;
  44. _cP = 0.01;
  45. bank_bank setVariable["reset",time,true];
  46. [1,"The bank is being robbed!"] remoteExec ["life_fnc_broadcast",0]; // General broadcast alert to everyone, uncomment for testing, or if you want it anyway.
  47.  
  48. while{true} do
  49. {
  50. uiSleep 7;
  51. _cP = _cP + (0.01 * (missionNamespace getVariable ["mav_ttm_var_robbingMultiplier", 1]));
  52. _progress progressSetPosition _cP;
  53. _pgText ctrlSetText format["Robbing, empty your inventory for gold bars, stay within 25 meters (%1%2)...",round(_cP * 100),"%"];
  54.  
  55. if(_cP >= 1 OR !alive _robber) exitWith {};
  56. if(_robber distance _shop > 25) exitWith {};
  57. if((_robber getVariable["restrained",false])) exitWith {};
  58. if(life_istazed) exitWith {} ;
  59. if(life_interrupted) exitWith {};
  60. };
  61.  
  62.  
  63. if!(alive _robber) exitWith { life_rip = false; call life_fnc_hudUpdate; };
  64. if(_robber distance _shop > 25) exitWith { ["You are too far away, robbery failed!",false,"slow"] call life_fnc_notificationSystem; 5 cutText ["","PLAIN"]; life_rip = false; call life_fnc_hudUpdate;};
  65. if(_robber getVariable "restrained") exitWith { life_rip = false; ["You have been arrested!",false,"slow"] call life_fnc_notificationSystem; 5 cutText ["","PLAIN"]; call life_fnc_hudUpdate;};
  66. if(life_istazed) exitWith { life_rip = false; ["You have been downed!",false,"slow"] call life_fnc_notificationSystem; 5 cutText ["","PLAIN"]; call life_fnc_hudUpdate;};
  67.  
  68. 5 cutText ["","PLAIN"];
  69. titleText[format["You have stolen $%1, Run!!",[_kassa] call life_fnc_numberText],"PLAIN"];
  70. findNearestPerson = findNearestPerson + _kassa;
  71. ["robbank"] spawn mav_ttm_fnc_addExp;
  72. [] call life_fnc_hudSetup;
  73. [0] call SOCK_fnc_updatePartial;
  74.  
  75. _rip = false;
  76. life_use_atm = true; // Robber can not use the ATM at this point.
  77. //playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player];
  78. if!(alive _robber) exitWith {};
  79. [0,format["Police News: The Bank has just been robbed: the stolen ammount of money was $%3!",name _robber, _shop, [_kassa] call life_fnc_numberText]] remoteExec ["life_fnc_broadcast",0];
  80. [0,format["Police News: The Bank has just been robbed: the stolen ammount of money was $%3!",name _robber, _shop, [_kassa] call life_fnc_numberText]] remoteExec ["life_fnc_broadcast",0];
  81. [getPlayerUID _robber,name _robber,"19"] remoteExec ["life_fnc_wantedAdd",2];
  82.  
  83. [] call life_fnc_hudUpdate;
  84. uiSleep (2 * 60);
Add Comment
Please, Sign In to add comment