Advertisement
dexatrin82

Untitled

Mar 7th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_Robshops.sqf
  4. Author: MrKraken
  5.  
  6. Description:
  7.  
  8. Modified by: Pril
  9.  
  10. */
  11. private ["_robber","_shop","_kassa","_ui","_pgText","_progress","_cP","_rip","_action"];
  12.  
  13. _shop = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
  14. _robber = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_param;
  15. _action = [_this,2] call BIS_fnc_param;
  16. _cops = (west countSide playableUnits);
  17.  
  18. if(side _robber !=civilian) exitWith {hint "You need to be a civilian to rob this shop.";};
  19. if(_robber distance _shop > 3) exitWith {hint "You need to stay within 3m to rob this shop";};
  20. if (vehicle player !=_robber) exitWith {hint "You need to be out of your vehicle first!";};
  21. if(_cops < 1) exitWith {hint "There isnt enough Police to rob Gas Station!";};
  22.  
  23. if!(alive _robber) exitWith {};
  24. if (currentWeapon _robber isEqualTo "") exitWith {hint "You need a weapons to rob this shop!";};
  25.  
  26. _rip = true;
  27. _kassa = 50000 + round(random 100000);
  28. _shop removeAction _action;
  29. _chance = random(100); // change this to a lower number, if you want the chance of getting money from the Robbery less.
  30.  
  31. if(_chance >=45) then {
  32. [1,format["000 ALERT:\n\n%1 is being robbed",_shop]] remoteExec ["life_fnc_broadcast",west]
  33. };
  34.  
  35. playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", _shop];
  36.  
  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 Shop, stay close (3m) (1%1)...","%"];
  43. _progress progressSetPosition 0.01;
  44. _cP = 0.01;
  45.  
  46. if(_rip) then
  47. {
  48. while{true} do
  49. {
  50. sleep 0.85;
  51. _cP = _cP + 0.01;
  52. _progress progressSetPosition _cP;
  53. _pgText ctrlSetText format ["Robbing Shop, stay close (3m) (%1%2)...",round(_cP * 100), "%"];
  54.  
  55. if (LIFE_SETTINGS(getNumber,"robberyMarkers") isEqualTo 1) then {
  56. _marker = createMarker ["Marker200", _shop];
  57. "Marker200" setMarkerColor "ColorRed";
  58. "Marker200" setMarkerText "ATTENTION: ROBBERY IN PROGRESS!!!";
  59. "Marker200" setMarkerType "mil_warning";
  60. };
  61.  
  62. if(_cP >=1) exitWith {};
  63. if(_robber distance _shop > 3.5) exitWith{deleteMarker "Marker200";};
  64. if!(alive _robber) exitWith {deleteMarker "Marker200";};
  65. };
  66.  
  67. if(_robber getVariable "restrained") exitWith {deleteMarker "Marker200"; _rip = false; hint "You have been restrained!!";}; //Player got arrested, or restrained by another player!
  68. if(life_istazed) exitWith {_rip = false; hint "You were tazed!"; deleteMarker "Marker200";}; //Player was tazed
  69. if!(alive _robber) exitWith {_rip = false;};
  70.  
  71. if(_robber distance _shop > 3.5) exitWith {
  72. deleteMarker "Marker200";
  73. hint "You need to stay within 3m to rob this shop! Cash register is now locked, and police have been notified!";
  74. 5 cutText ["","PLAIN"];
  75. [1,format["%1 attempted to rob %2!",_robber,name _robber, _shop]] remoteExec ["life_fnc_broadcast",west];
  76. [getPlayerUID _robber, _robber getVariable ["realname",name _robber], "211"] remoteExecCall ["life_fnc_wantedAdd", RSERV];
  77. };
  78. 5 cutText ["","PLAIN"];
  79.  
  80. titleText[format["You managed to steal %1, now get away before the cops arrive!",[_kassa] call life_fnc_numberText], "PLAIN"];
  81. life_cash = life_cash + _kassa;
  82. deleteMarker "Marker200";
  83. _rip = false;
  84. life_use_atm = false;
  85. sleep 10;
  86. [1, format["Altis News Corp: Gas Staion %1 was robbed for a total of $%2",_shop, [_kassa] call life_fnc_numberText]] remoteExec ["life_fnc_broadcast", civilian];
  87. sleep ((LIFE_SETTINGS(getNumber,"noatm_timer")) * 60);
  88. life_use_atm = true;
  89. if!(alive _robber) exitWith {};
  90. [getPlayerUID _robber, _robber getVariable ["realname",name _robber], "211"] remoteExecCall ["life_fnc_wantedAdd", RSERV];
  91. call SOCK_fnc_updatePartial;
  92. };
  93. sleep 300; //5 Minutes
  94. _action = _shop addAction["Rob Shop",life_fnc_robShops,civilian];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement