Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. /*
  2. @Version: 3.1b
  3. @Author: [BWG] Joe
  4. @Edited: 10.02.2014
  5. */
  6. private ["_funds","_handle","_time","_minutesLeft"];
  7.  
  8. if (playerSide != civilian) exitWith {};
  9.  
  10. // Check if there are enough rebels online.
  11. //NEED FIX: _rebels = { (isPlayer _x) && (side (group _x) == west) } count playableUnits;
  12. //NEED FIX: if (_rebels < 7) exitWith {
  13. //NEED FIX: hint format ["The casino is closed because there are only %1 rebels online.", _rebels];
  14. //NEED FIX: };
  15.  
  16. //NEED FIX: bank_query = player;
  17. //NEED FIX: publicVariableServer "bank_query";
  18. //NEED FIX: waitUntil {!isNil {bank_query_funds}};
  19. //NEED FIX: _funds = bank_query_funds;
  20. //NEED FIX: bank_query_funds = nil;
  21.  
  22. if (_funds < 500000) exitWith {
  23. hint format["You cannot rob the casino yet, there is not enough money in the safe.\n\nCurrent Funds: $%1", [_funds] call life_fnc_formatMoney];
  24. };
  25.  
  26. if (_funds > 1000000) then { _funds = 1000000; };
  27.  
  28. hint "Attempting to open the safe...";
  29. sleep 1;
  30.  
  31. if ((casino_obj getVariable "rob_in_progress")) exitWith {hint "Casino is already being robbed!"};
  32. casino_obj setVariable["rob_in_progress", true, true];
  33.  
  34. titleText["Cracking the safe...", "PLAIN"];
  35.  
  36. [[], "life_fnc_playCasinoAlarm", true, false] spawn BIS_fnc_MP;
  37.  
  38. [[2, "!!!!! THE CASINO IS BEING ROBBED !!!!!"], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
  39.  
  40. _handle = [] spawn {
  41. // Time to rob in minutes
  42. _time = 10;
  43. for "_i" from 0 to (_time*6) do {
  44. sleep 10;
  45.  
  46. if (!(casino_obj getVariable "rob_in_progress")) exitWith { hint "Something went wrong with the robbery! So it failed, try again soon."; life_casino_fail = true; };
  47. if (!alive player || player getVariable ["wounded", false]) exitWith { life_casino_fail = true; };
  48. if ((currentWeapon player) == "") exitWith { hint "You don't have a gun! Robbery failed!"; life_casino_fail = true; };
  49. if (player distance casino_obj > 10) exitWith { hint "You moved to far away from the casino! Robbery failed!"; life_casino_fail = true; };
  50. if (player getVariable "restrained") exitWith { hint "You got restrained! Robbery failed!"; life_casino_fail = true; };
  51.  
  52. // Show remaining time every minute.
  53. if (_i % 6 == 0 && _i != 0 && _i != _time*6) then {
  54. _minutesLeft = ((_time * 6) - _i) / 6;
  55. [[2, format["!!!!! THE CASINO IS STILL BEING ROBBED - %1 MINUTES UNTIL SUCCESSFUL ROBBERY !!!!!", _minutesLeft]], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
  56. // Play alarm if only 1 minute left.
  57. if (_minutesLeft == 1) then {
  58. [[], "life_fnc_playCasinoAlarm", true, false] spawn BIS_fnc_MP;
  59. };
  60. };
  61.  
  62. hint format["You have %1 seconds remaining...", (_time*60 - (10 * _i))];
  63. };
  64. };
  65.  
  66. waitUntil {scriptDone _handle};
  67.  
  68. if (alive player && !(player getVariable "restrained") && !life_istazed && !life_casino_fail) then {
  69.  
  70. //NEED FIX: bank_resetfunds = 0;
  71.  
  72. //NEED FIX: publicVariableServer "bank_resetfunds";
  73.  
  74. life_inv_markedMoney = life_inv_markedMoney + _funds;
  75.  
  76. casino_obj setVariable ["rob_in_progress", false, true];
  77.  
  78. titleText[format["You have stolen $%1 from the casino!", [_funds] call life_fnc_formatMoney], "PLAIN"];
  79. hint format["You have stolen $%1 from the casino!", [_funds] call life_fnc_formatMoney];
  80. [[0, format["$%1 was stolen from the casino robbery!", [_funds] call life_fnc_formatMoney]], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
  81. server_fnc_log = format ["***CASINO ROBBERY***: Name: %1 - Stolen: $%2 - Cash: $%3 - Casino: $%4", name player, _funds, life_cash, life_atmcash];
  82. publicVariableServer "server_fnc_log";
  83. } else {
  84. life_casino_fail = false;
  85. titleText["You failed to rob the casino!", "PLAIN"];
  86. [[0, format["The casino robbery has failed!"]], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
  87. diag_log format ["%1 has failed to rob the casino.", name player];
  88. casino_obj setVariable["rob_in_progress", false, true];
  89. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement