Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @Version: 3.1b
- @Author: [BWG] Joe
- @Edited: 10.02.2014
- */
- private ["_funds","_handle","_time","_minutesLeft"];
- if (playerSide != civilian) exitWith {};
- // Check if there are enough rebels online.
- //NEED FIX: _rebels = { (isPlayer _x) && (side (group _x) == west) } count playableUnits;
- //NEED FIX: if (_rebels < 7) exitWith {
- //NEED FIX: hint format ["The casino is closed because there are only %1 rebels online.", _rebels];
- //NEED FIX: };
- //NEED FIX: bank_query = player;
- //NEED FIX: publicVariableServer "bank_query";
- //NEED FIX: waitUntil {!isNil {bank_query_funds}};
- //NEED FIX: _funds = bank_query_funds;
- //NEED FIX: bank_query_funds = nil;
- if (_funds < 500000) exitWith {
- 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];
- };
- if (_funds > 1000000) then { _funds = 1000000; };
- hint "Attempting to open the safe...";
- sleep 1;
- if ((casino_obj getVariable "rob_in_progress")) exitWith {hint "Casino is already being robbed!"};
- casino_obj setVariable["rob_in_progress", true, true];
- titleText["Cracking the safe...", "PLAIN"];
- [[], "life_fnc_playCasinoAlarm", true, false] spawn BIS_fnc_MP;
- [[2, "!!!!! THE CASINO IS BEING ROBBED !!!!!"], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
- _handle = [] spawn {
- // Time to rob in minutes
- _time = 10;
- for "_i" from 0 to (_time*6) do {
- sleep 10;
- 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; };
- if (!alive player || player getVariable ["wounded", false]) exitWith { life_casino_fail = true; };
- if ((currentWeapon player) == "") exitWith { hint "You don't have a gun! Robbery failed!"; life_casino_fail = true; };
- if (player distance casino_obj > 10) exitWith { hint "You moved to far away from the casino! Robbery failed!"; life_casino_fail = true; };
- if (player getVariable "restrained") exitWith { hint "You got restrained! Robbery failed!"; life_casino_fail = true; };
- // Show remaining time every minute.
- if (_i % 6 == 0 && _i != 0 && _i != _time*6) then {
- _minutesLeft = ((_time * 6) - _i) / 6;
- [[2, format["!!!!! THE CASINO IS STILL BEING ROBBED - %1 MINUTES UNTIL SUCCESSFUL ROBBERY !!!!!", _minutesLeft]], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
- // Play alarm if only 1 minute left.
- if (_minutesLeft == 1) then {
- [[], "life_fnc_playCasinoAlarm", true, false] spawn BIS_fnc_MP;
- };
- };
- hint format["You have %1 seconds remaining...", (_time*60 - (10 * _i))];
- };
- };
- waitUntil {scriptDone _handle};
- if (alive player && !(player getVariable "restrained") && !life_istazed && !life_casino_fail) then {
- //NEED FIX: bank_resetfunds = 0;
- //NEED FIX: publicVariableServer "bank_resetfunds";
- life_inv_markedMoney = life_inv_markedMoney + _funds;
- casino_obj setVariable ["rob_in_progress", false, true];
- titleText[format["You have stolen $%1 from the casino!", [_funds] call life_fnc_formatMoney], "PLAIN"];
- hint format["You have stolen $%1 from the casino!", [_funds] call life_fnc_formatMoney];
- [[0, format["$%1 was stolen from the casino robbery!", [_funds] call life_fnc_formatMoney]], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
- server_fnc_log = format ["***CASINO ROBBERY***: Name: %1 - Stolen: $%2 - Cash: $%3 - Casino: $%4", name player, _funds, life_cash, life_atmcash];
- publicVariableServer "server_fnc_log";
- } else {
- life_casino_fail = false;
- titleText["You failed to rob the casino!", "PLAIN"];
- [[0, format["The casino robbery has failed!"]], "life_fnc_broadcastMessage", true, false] spawn BIS_fnc_MP;
- diag_log format ["%1 has failed to rob the casino.", name player];
- casino_obj setVariable["rob_in_progress", false, true];
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement