Jump to content

[Tutorial] MrKraken's ATM Robbery Script


Recommended Posts

Author: MrKraken

Difficulty: Easy

Source: Altisliferpg.com (cache recovery)

Let's Get Started

First navigate to the core folder then the functions folder, Create a file calledfn_robATM.sqf and paste

/*
file: fn_robATM.sqf
Author: MrKraken
Made from MrKrakens bare-bones shop robbing tutorial on www.altisliferpg.com forums
Description:
Executes the rob shob action!
Idea developed by PEpwnzya v1.0
*/
private["_robber","_shop","_kassa","_ui","_progress","_pgText","_cP","_rip","_pos"];
_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
_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
//_kassa = 1000; //The amount the shop has to rob, you could make this a parameter of the call (https://community.bi.../wiki/addAction). Give it a try and post below ;)
_action = [_this,2] call BIS_fnc_param;//Action name
 
if(side _robber != civilian) exitWith { hint "You can not rob this ATM!" };
if(_robber distance _shop > 2) exitWith { hint "You need to be within 2m of the ATM!" };
 
if !(_kassa) then { _kassa = 1000; };
if (_rip) exitWith { hint "Robbery already in progress!" };
if (vehicle player != _robber) exitWith { hint "Get out of your vehicle!" };
 
if !(alive _robber) exitWith {};
if(!([false,"boltcutter",1] call life_fnc_handleInv)) exitWith {"You dont have Boltcutter's"};
if (_kassa == 0) exitWith { hint "There is no cash in the register!" };
 
_rip = true;
_kassa = 20000 + round(random 30000);
_shop removeAction _action;
_shop switchMove "AmovPercMstpSsurWnonDnon";
_chance = random(100);
if(_chance >= 85) then { hint "The ATM has a silent alarm, police has been alerted!"; [[1,format["ALARM! - ATM: %1 is being robbed!", _shop]],"life_fnc_broadcast",west,false] spawn life_fnc_MP; };
 
_cops = (west countSide playableUnits);
if(_cops < 2) exitWith{[[_vault,-1],"disableSerialization;",false,false] spawn life_fnc_MP; hint "There isnt enough Police to rob the ATM!";};
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["Robbery in Progress, stay close (2m) (1%1)...","%"];
_progress progressSetPosition 0.01;
_cP = 0.01;
 
if(_rip) then
{
while{true} do
{
sleep 0.85;
_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["Robbery in Progress, stay close (2m) (%1%2)...",round(_cP * 100),"%"];
_Pos = position player; // by ehno: get player pos
               _marker = createMarker ["Marker200", _Pos]; //by ehno: Place a Maker on the map
               "Marker200" setMarkerColor "ColorRed";
               "Marker200" setMarkerText "!ATTENTION! robbery !ATTENTION!";
               "Marker200" setMarkerType "mil_warning";
if(_cP >= 1) exitWith {};
if(_robber distance _shop > 2.5) exitWith { };
if!(alive _robber) exitWith {};
};
if!(alive _robber) exitWith { _rip = false; };
if(_robber distance _shop > 2.5) exitWith { deleteMarker "Marker200"; _shop switchMove ""; hint "You need to stay within 2m to Rob ATM! - Now the ATM is locked."; 5 cutText ["","PLAIN"]; _rip = false; };
5 cutText ["","PLAIN"];
 
titleText[format["You have stolen $%1, now get away before the cops arrive!",[_kassa] call life_fnc_numberText],"PLAIN"];
deleteMarker "Marker200"; // by ehno delete maker
life_cash = life_cash + _kassa;
 
_rip = false;
life_use_atm = false;
sleep (30 + random(180));
life_use_atm = true;
if!(alive _robber) exitWith {};
[getPlayerUID _robber,name _robber,"211"]remoteExec["life_fnc_wantedAdd",false,false]
};
sleep 300;
_action = _shop addAction["Rob the ATM",life_fnc_robATM];
_shop switchMove "";
 

Second open Functions.hpp in root directory and paste under class functions

class robATM {};

Third open your mission.sqm in Editor and add below to the ATM's

this addAction["Rob the ATM",life_fnc_robATM];

Now You Are Finished.

Edited by StonerGaming
  • Like 1
Link to post
Share on other sites
7 minutes ago, StonerGaming said:

worked fine on the version I'm using

Which version is that? Definitely super old and outdated. As I said, it won't work on the newest / latest version of AL.

Edited by Dark
Link to post
Share on other sites
33 minutes ago, StonerGaming said:

if(_chance >= 85) then { hint "The ATM has a silent alarm, police has been alerted!"; [[1,format["ALARM! - Gasstation: %1 is being robbed!", _shop]],"life_fnc_broadcast",west,false] spawn life_fnc_MP; };

 

33 minutes ago, StonerGaming said:

if(_cops < 2) exitWith{[[_vault,-1],"disableSerialization;",false,false] spawn life_fnc_MP; hint "There isnt enough Police to rob the ATM!";};

 

33 minutes ago, StonerGaming said:

[[getPlayerUID _robber,name _robber,"211"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;

While it might work, it's going to be a little .. broken. The silent alarm wont go off. The cop check might not work either. It also definitely won't add the robber to the wanted list.

2 minutes ago, StonerGaming said:

worked fine for me, I had no issues at all. It is just like to the rob gas station script

Nope, it's not. Look over it.

https://www.altisliferpg.com/topic/5-basics-mrkrakens-gas-station-robbery-script/

Edited by Dark
Link to post
Share on other sites

Lol.... MP remote whitelisting is outdated :L

 

[[getPlayerUID _robber,name _robber,"211"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;

 

->

[[getPlayerUID _robber,name _robber,"211"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;

->

[[getPlayerUID _robber,name _robber,"211"],"life_fnc_wantedAdd",false,false]

->

[getPlayerUID _robber,name _robber,"211"],"life_fnc_wantedAdd",false,false]

->

[getPlayerUID _robber,name _robber,"211"],["life_fnc_wantedAdd",false,false]

->

[getPlayerUID _robber,name _robber,"211"] remoteExec ["life_fnc_wantedAdd",false,false]

and of course.

[getPlayerUID _robber,name _robber,"211"] remoteExec ["life_fnc_wantedAdd",false,false];

 

if last data in array is boolean remove completely.

If second last data in array is boolean remove and replace with number. Depending if its "ANYONE, CLIENT, SERVER".

 

[getPlayerUID _robber,name _robber,"211"] remoteExec ["life_fnc_wantedAdd",2];

 

Number Calls for remoteExec (Unless changed.):

0: Anyone

1: Client

2: Server

 

I pretty much just showed you how to convert MP to remoteExec.

 

Quote

 

  • Like 1
Link to post
Share on other sites

Hi,

Made a up-to-date script which shall work, may have a bug or two since I made this at 4 in the morning and a bit tired, but just let me know if there is any problems. But generally should be more reliable.

Make sure to redefine variables to your liking and make sure to put command hint in your RemoteExec whitelist. Please do not remove the header! :)

/**
    * SimZor 2017
    * [email protected]
    * Everyone allowed to use script as long as this header stays in place
*/

// -- Get Parameters from action
_this params [
    ["_atm", objNull, [objNull]],
    ["_robber", player, [objNull]],
    ["_action"]
];

// -- Define these options please!
private _amount = 20000; // -- Amount which will be the base which the players will always get minimum
private _randomMoney = 30000; // -- Define amount that should be randomized
private _cooldown = 200; // -- Cooldown until ATM can be robbed again after already being robbed
private _atmPlayAnimation = false; // -- Player Shop Animation (NPC)
private _atmAnimation = "AmovPercMstpSsurWnonDnon"; // -- Define animation to be played
private _alarmPercentage = 80; // -- Percent change that alarm will go off and send a message to police
private _messageOnlyBlufor = true; // -- Set to false if everyone should be notified of the gas station robbery
private _neededBluforUnits = 3; // -- Define blufor units required to carry out robbery
private _cashvariable = life_cash;

// -- Checks
if !(side _robber isEqualTo civilian) exitWith {};
if !(vehicle player isEqualTo _robber) exitWith {};
if (_robber distance _atm > 2) exitwith {};
if !(alive _robber) exitWith {};
if (life_inv_boltcutter <= 0) exitWith {};
private _bluforUnits = (west countSide playableUnits);
if (_bluforUnits < 2) exitWith {};

// -- Remvoe Option from NPC or other object
_atm removeAction _action;

// -- Switch move if applicable
if (_atmPlayAnimation) then {
    _atm playMove _atmAnimation;
};

// -- Notify Authorities if there is _alarmPercentage chance
if (random 100 >= _alarmPercentage) then {
    // -- Get Closest Town
    text (nearestLocations [player, ["NameCityCapital","NameCity","NameVillage"], 10000]) params ["_closestTown"];

    // -- Notify player
    hint "Alarm has been triggered, authorities has been notified";

    // -- Send message to notify all targets
    private _broadcastTargets = if (_messageOnlyBlufor) then {west} else {-2};
    [format parseText ["<t font='PuristaMedium' align='center'>WARNING</t><br/><t font'PuristaLight'>There is currently an ATM being robbed at %1. Nearest town is %2. Check your map for more information!</t>", getPos _atm, _closestTown]] remoteExecCall ["hint", _broadcastTargets];

    // -- Create Marker
    private _marker = createMarker ["ATM_Robbery_Marker", position player];
    "ATM_Robbery_Marker" setMarkerColor "ColorRed";
    "ATM_Robbery_Marker" setMarkerText "ATM Robbery in Progress";
    "ATM_Robbery_Marker" setMarkerType "mil_warning";
};

// -- Disable Serialization
disableSerialization;

// -- Create Resource and Setup Variables
"ATM_Robbery" cutRsc ["life_progress", "PLAIN"];
private _ui = uiNameSpace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;

// -- Set Default Values
_pgText ctrlSetText format ["Breaking into ATM [1%1]", "%"];
_progress progressSetPosition 0.01;

private _cP = 0.01;
private _success = false;
while {true} do {

    sleep 0.01;
    _cP = _cP + 0.0001;

    // -- Update Values
    _progress progressSetPosition _cP;
    _pgText ctrlSetText format ["Breaking into ATM [%1%2]", round (_cP * 100), "%"];

    // -- Checks
    if (_cp >= 1) exitWith {_success = true;};
    if (_robber distance _atm > 2.5 || {!alive _robber}) exitWith {};

};

// -- Remove Progress Bar
"ATM_Robbery" cutText ["","PLAIN"];

// -- Reset animation
_atm switchMove "";

// -- Delete robbery marker
deleteMarker "ATM_Robbery_Marker";

if (_successfull) then {
    // -- Set amount to give player if successfull
    private _amount = _amount + round (random _amount);

    // -- Add cash to player
    _cashvariable = _cashvariable + _amount;

    // -- Notify
    hint format ["You have successfully broken into the ATM and stolen"];

    // -- Make spawn here so rest of script can still continue
    [] spawn {
        scriptName "life_fnc_robATM: ATM Handler";

        life_use_atm = false;
        sleep (60 + random(180));
        life_use_atm = true;
    };
};

// -- Add to wanted list
[getPlayerUID _robber, name _robber, "211"] remoteExec ["life_fnc_wantedAdd",2];

// -- Handle Cooldown
[_action, _atm] spawn {
    scriptName "life_fnc_robATM: ATM Cooldown Handler";

    // -- Wait
    sleep _cooldown;

    // -- Add action to ATM once again
    _action = _atm addAction ["Break into ATM", life_fnc_robATM];
};

 

Edited by SimZor - Frogman Life
Link to post
Share on other sites
  • 3 weeks later...
On 3/8/2017 at 7:16 AM, StonerGaming said:

Author: MrKraken

Difficulty: Easy

Source: Altisliferpg.com (cache recovery)

Let's Get Started

First navigate to the core folder then the functions folder, Create a file calledfn_robATM.sqf and paste

/*
file: fn_robATM.sqf
Author: MrKraken
Made from MrKrakens bare-bones shop robbing tutorial on www.altisliferpg.com forums
Description:
Executes the rob shob action!
Idea developed by PEpwnzya v1.0
*/
private["_robber","_shop","_kassa","_ui","_progress","_pgText","_cP","_rip","_pos"];
_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
_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
//_kassa = 1000; //The amount the shop has to rob, you could make this a parameter of the call (https://community.bi.../wiki/addAction). Give it a try and post below ;)
_action = [_this,2] call BIS_fnc_param;//Action name
 
if(side _robber != civilian) exitWith { hint "You can not rob this ATM!" };
if(_robber distance _shop > 2) exitWith { hint "You need to be within 2m of the ATM!" };
 
if !(_kassa) then { _kassa = 1000; };
if (_rip) exitWith { hint "Robbery already in progress!" };
if (vehicle player != _robber) exitWith { hint "Get out of your vehicle!" };
 
if !(alive _robber) exitWith {};
if(!([false,"boltcutter",1] call life_fnc_handleInv)) exitWith {"You dont have Boltcutter's"};
if (_kassa == 0) exitWith { hint "There is no cash in the register!" };
 
_rip = true;
_kassa = 20000 + round(random 30000);
_shop removeAction _action;
_shop switchMove "AmovPercMstpSsurWnonDnon";
_chance = random(100);
if(_chance >= 85) then { hint "The ATM has a silent alarm, police has been alerted!"; [[1,format["ALARM! - ATM: %1 is being robbed!", _shop]],"life_fnc_broadcast",west,false] spawn life_fnc_MP; };
 
_cops = (west countSide playableUnits);
if(_cops < 2) exitWith{[[_vault,-1],"disableSerialization;",false,false] spawn life_fnc_MP; hint "There isnt enough Police to rob the ATM!";};
disableSerialization;
5 cutRsc ["life_progress","PLAIN"];
_ui = uiNameSpace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["Robbery in Progress, stay close (2m) (1%1)...","%"];
_progress progressSetPosition 0.01;
_cP = 0.01;
 
if(_rip) then
{
while{true} do
{
sleep 0.85;
_cP = _cP + 0.01;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["Robbery in Progress, stay close (2m) (%1%2)...",round(_cP * 100),"%"];
_Pos = position player; // by ehno: get player pos
               _marker = createMarker ["Marker200", _Pos]; //by ehno: Place a Maker on the map
               "Marker200" setMarkerColor "ColorRed";
               "Marker200" setMarkerText "!ATTENTION! robbery !ATTENTION!";
               "Marker200" setMarkerType "mil_warning";
if(_cP >= 1) exitWith {};
if(_robber distance _shop > 2.5) exitWith { };
if!(alive _robber) exitWith {};
};
if!(alive _robber) exitWith { _rip = false; };
if(_robber distance _shop > 2.5) exitWith { deleteMarker "Marker200"; _shop switchMove ""; hint "You need to stay within 2m to Rob ATM! - Now the ATM is locked."; 5 cutText ["","PLAIN"]; _rip = false; };
5 cutText ["","PLAIN"];
 
titleText[format["You have stolen $%1, now get away before the cops arrive!",[_kassa] call life_fnc_numberText],"PLAIN"];
deleteMarker "Marker200"; // by ehno delete maker
life_cash = life_cash + _kassa;
 
_rip = false;
life_use_atm = false;
sleep (30 + random(180));
life_use_atm = true;
if!(alive _robber) exitWith {};
[getPlayerUID _robber,name _robber,"211"]remoteExec["life_fnc_wantedAdd",false,false]
};
sleep 300;
_action = _shop addAction["Rob the ATM",life_fnc_robATM];
_shop switchMove "";
 

Second open Functions.hpp in root directory and paste under class functions

class robATM {};

Third open your mission.sqm in Editor and add below to the ATM's

this addAction["Rob the ATM",life_fnc_robATM];

Now You Are Finished.

this script dont work on version 3.1.2 

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.