Jump to content
Deadlesszombie

[4.4] Prison Clothes

Recommended Posts

Author Name: Neil Smith / Deadlesszombie

Difficulty: Easy

Purpose of Script: Upon being jailed, the old loadout of the player is saved, then all items are removed from the player, and the jail uniform is assigned. If the player escapes jail, their gear is not returned, if they pay bail or do their full time, they recieve their clothing back!

YOU WILL ALSO NEED YOUR OWN CLOTHES, 

"player addUniform "PUT YOUR UNIFORM FOR JAIL HERE!!!!!";"

Go to MissionFile\core\civillian\fn_jailMe.sqf add this right under 

#include "..\..\script_macros.hpp"
/*
 Author Bryan "Tonic" Boardwine
 Description:
 Once word is received by the server the rest of the jail execution is completed.
 Edited by Neil Smith
*/
private["_time","_bail","_esc","_countDown"];
params [
 ["_ret",[],[[]]],
 ["_bad",false,[false]],
 ["_time",15,[0]]
];

put this under it:

make sure you replace "player addUniform "PUT YOUR UNIFORM FOR JAIL HERE!!!!!";"

//Begin jail uniform
hint "Your gear has been placed in the evidence locker!";
old_gear = getUnitLoadout player;
removeUniform player;
removeHeadgear player;
removeVest player;
removeGoggles player;
removeBackpack player;
removeallWeapons player;
removeallAssignedItems player;
player addUniform "PUT YOUR UNIFORM FOR JAIL HERE!!!!!";

you should now have this:

#include "..\..\script_macros.hpp"
/*
 Author Bryan "Tonic" Boardwine
 Description:
 Once word is received by the server the rest of the jail execution is completed.
 Edited by Neil Smith
*/
private["_time","_bail","_esc","_countDown"];
params [
 ["_ret",[],[[]]],
 ["_bad",false,[false]],
 ["_time",15,[0]]
];

//Begin jail uniform
hint "Your gear has been placed in the evidence locker!";
old_gear = getUnitLoadout player;
removeUniform player;
removeHeadgear player;
removeVest player;
removeGoggles player;
removeBackpack player;
removeallWeapons player;
removeallAssignedItems player;
player addUniform "PUT YOUR UNIFORM FOR JAIL HERE!!!!!";

Now scroll down and add this for each case function, depending on if you want the players to get their gear on what case

(Note: case _bail means they paid the bail and they are now free, case _esc means they escaped prison, and case !_esc && !_bail means they did their full time in prison)

 

 player setUnitLoadout old_gear;
 hint "Because you have done your time in prison, you will recieve your clothing shortly";
 [] call life_fnc_saveGear;

 

An example of what you should have depending on how you want it:

switch (true) do {
 case (_bail): {
 life_is_arrested = false;
 life_bail_paid = false;
 hint localize "STR_Jail_Paid";
 serv_wanted_remove = [player];
 player setPos (getMarkerPos "civ_spawn_1");
 [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
 hint "Because you have paid your bail, you will recieve your clothing shortly";
 player setUnitLoadout old_gear;
 [] call life_fnc_saveGear;
 [5] call SOCK_fnc_updatePartial;
 };
 case (_esc): {
 life_is_arrested = false;
 hint localize "STR_Jail_EscapeSelf";
 [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
 [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
 hint "Because you escaped from jail, the jail guards have placed your gear in the trash";
 [] call life_fnc_saveGear;
 [5] call SOCK_fnc_updatePartial;
 };
 case (alive player && !_esc && !_bail): {
 life_is_arrested = false;
 hint localize "STR_Jail_Released";
 [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
 player setPos (getMarkerPos "civ_spawn_1");
 player setUnitLoadout old_gear;
 hint "Because you have done your time in prison, you will recieve your clothing shortly";
 [] call life_fnc_saveGear;
 [5] call SOCK_fnc_updatePartial;
 };
};

 

Example full script if you are completely lost

Spoiler
#include "..\..\script_macros.hpp"
/*
 Author Bryan "Tonic" Boardwine
 Description:
 Once word is received by the server the rest of the jail execution is completed.
 Edited by Neil Smith
*/
private["_time","_bail","_esc","_countDown"];
params [
 ["_ret",[],[[]]],
 ["_bad",false,[false]],
 ["_time",15,[0]]
];

//Begin jail uniform
hint "Your gear has been placed in the evidence locker!";
old_gear = getUnitLoadout player;
removeUniform player;
removeHeadgear player;
removeVest player;
removeGoggles player;
removeBackpack player;
removeallWeapons player;
removeallAssignedItems player;
player addUniform "PUT YOUR UNIFORM FOR JAIL HERE!!!!!";

_time = time + (_time * 60);
if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; };
_esc = false;
_bail = false;
if(_time <= 0) then { _time = time + (15 * 60); hintC "Please Report to Admin: JAIL_FALLBACK_15, time is zero!"; };
[_bad,_time] spawn {
 life_canpay_bail = false;
 life_bail_amount = life_bail_amount * 5;
 if(_this select 0) then {
 sleep ( (_this select 1) * 0.5 );
 } else {
 sleep ( (_this select 1) * 0.2 );
 };
 life_canpay_bail = nil;
};
while {true} do {
 if((round(_time - time)) > 0) then {
 _countDown = if(round (_time - time) > 60) then {format["%1 Minute(s)",round(round(_time - time) / 60)]} else {format["%1 Second(s)",round(_time - time)]};
 if(isNil "life_canpay_bail") then {
 hintSilent format["Time Remaining:\n %1\n\nCan pay Bail: %3\nBail Amount: $%2",_countDown,[life_bail_amount] call life_fnc_numberText, "dass"];
 } else {
 hintSilent format["Time Remaining:\n %1\n",_countDown];
 };
 };
 if(player distance (getMarkerPos "jail_marker") > 300) exitWith {
 _esc = true;
 };
 if(life_bail_paid) exitWith {
 _bail = true;
 };
 if((round(_time - time)) < 1) exitWith {hint ""};
 if(!alive player && ((round(_time - time)) > 0)) exitWith {};
 sleep 1;
};


switch (true) do {
 case (_bail): {
 life_is_arrested = false;
 life_bail_paid = false;
 hint localize "STR_Jail_Paid";
 serv_wanted_remove = [player];
 player setPos (getMarkerPos "civ_spawn_1");
 [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
 hint "Because you have paid your bail, you will recieve your clothing shortly";
 player setUnitLoadout old_gear;
 [] call life_fnc_saveGear;
 [5] call SOCK_fnc_updatePartial;
 };
 case (_esc): {
 life_is_arrested = false;
 hint localize "STR_Jail_EscapeSelf";
 [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
 [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
 hint "Because you escaped from jail, the jail guards have placed your gear in the trash";
 [] call life_fnc_saveGear;
 [5] call SOCK_fnc_updatePartial;
 };
 case (alive player && !_esc && !_bail): {
 life_is_arrested = false;
 hint localize "STR_Jail_Released";
 [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
 player setPos (getMarkerPos "civ_spawn_1");
 player setUnitLoadout old_gear;
 hint "Because you have done your time in prison, you will recieve your clothing shortly";
 [] call life_fnc_saveGear;
 [5] call SOCK_fnc_updatePartial;
 };
};

 

Special thanks to @DesusaED and @TwisT For confirming and helping me fix an issue

Edited by Deadlesszombie
  • Like 1

Share this post


Link to post
Share on other sites

Doesn't seem to work on v5.0

When i jail someone, they keep their clothes but when they escape, they get prison clothes.

If i find the problem myself, i'll post it here

Share this post


Link to post
Share on other sites

It puts the clothes on the players when they get released for me as well. Did you find a fix Mr. Man?

Share this post


Link to post
Share on other sites
7 hours ago, TwisT said:

It puts the clothes on the players when they get released for me as well. Did you find a fix Mr. Man?

Its working for me.. let me post my stufe her for you. this is for the 5.0 version. copy that.

 

#include "..\..\script_macros.hpp"
/*
    File: fn_jailMe.sqf
    Author Bryan "Tonic" Boardwine

    Description:
    Once word is received by the server the rest of the jail execution is completed.
*/
private ["_time","_bail","_esc","_countDown"];

params [
    ["_ret",[],[[]]],
    ["_bad",false,[false]]
];


if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };

if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
_esc = false;
_bail = false;

[_bad] spawn {
    life_canpay_bail = false;
    if (_this select 0) then {
        sleep (10 * 60);
    } else {
        sleep (5 * 60);
    };
    life_canpay_bail = true;
};

for "_i" from 0 to 1 step 0 do {
    if ((round(_time - time)) > 0) then {
        _countDown = [(_time - time),"MM:SS.MS"] call BIS_fnc_secondsToString;
        hintSilent parseText format [(localize "STR_Jail_Time")+ "<br/> <t size='2'><t color='#FF0000'>%1</t></t><br/><br/>" +(localize "STR_Jail_Pay")+ " %3<br/>" +(localize "STR_Jail_Price")+ " $%2",_countDown,[life_bail_amount] call life_fnc_numberText,if (life_canpay_bail) then {"Yes"} else {"No"}];
    };

    if (LIFE_SETTINGS(getNumber,"jail_forceWalk") isEqualTo 1) then {
        player forceWalk true;
    };

    private _escDist = [[["Altis", 60], ["Tanoa", 145]]] call TON_fnc_terrainSort;
    
    if (player distance (getMarkerPos "jail_marker") > _escDist) exitWith {
        _esc = true;
    };

    if (life_bail_paid) exitWith {
        _bail = true;
    };

    if ((round(_time - time)) < 1) exitWith {hint ""};
    if (!alive player && ((round(_time - time)) > 0)) exitWith {};
    sleep 0.1;
};

//Begin jail uniform
hint "Your gear has been placed in the evidence locker!";
old_gear = getUnitLoadout player;
removeUniform player;
removeHeadgear player;
removeVest player;
removeGoggles player;
removeBackpack player;
removeallWeapons player;
removeallAssignedItems player;
player addUniform "mgsr_robe_dirty";


switch (true) do {
    case (_bail): {
        life_is_arrested = false;
        life_bail_paid = false;

        hint localize "STR_Jail_Paid";
        player setPos (getMarkerPos "jail_release");

        if (life_HC_isActive) then {
            [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
        } else {
            [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
        };
        player setUnitLoadout old_gear;
        hint "Because you have done your time in prison, you will recieve your clothing shortly";
        [] call life_fnc_saveGear;
        [5] call SOCK_fnc_updatePartial;
    };

    case (_esc): {
        life_is_arrested = false;
        hint localize "STR_Jail_EscapeSelf";
        [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];

        if (life_HC_isActive) then {
            [getPlayerUID player,profileName,"901"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
        } else {
            [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
        };
         hint "Because you escaped from jail, the jail guards have placed your gear in the trash";
         [] call life_fnc_saveGear;

        [5] call SOCK_fnc_updatePartial;
    };

    case (alive player && !_esc && !_bail): {
        life_is_arrested = false;
        hint localize "STR_Jail_Released";

        if (life_HC_isActive) then {
            [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
        } else {
            [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
        };
        player setUnitLoadout old_gear;
        hint "Because you have done your time in prison, you will recieve your clothing shortly";
        [] call life_fnc_saveGear;
        player setPos (getMarkerPos "jail_release");
        [5] call SOCK_fnc_updatePartial;
    };
};

player forceWalk false; // Enable running & jumping

 

Share this post


Link to post
Share on other sites
On 12/17/2017 at 3:08 AM, Mr. Man said:

Doesn't seem to work on v5.0

When i jail someone, they keep their clothes but when they escape, they get prison clothes.

If i find the problem myself, i'll post it here

This should work on 5.0, however, if not on different versions of Altis Life it is easy to follow the process.

Use the same concept of the  player forceAddUniform"";  and then apply basic knowledge to make the prisoner retrieve the old clothing.

If you explore the jail files you can find how this would work easy with basic commands, its quite easy just try apply it yourself.

If your prisoners are retrieving the Uniform upon breaking out of prison, you may of simply applied the script wrongly.

Edited by tubsta
  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, DesusaED said:

Its working for me.. let me post my stufe her for you. this is for the 5.0 version. copy that.

 

#include "..\..\script_macros.hpp"
/*
    File: fn_jailMe.sqf
    Author Bryan "Tonic" Boardwine

    Description:
    Once word is received by the server the rest of the jail execution is completed.
*/
private ["_time","_bail","_esc","_countDown"];

params [
    ["_ret",[],[[]]],
    ["_bad",false,[false]]
];


if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };

if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
_esc = false;
_bail = false;

[_bad] spawn {
    life_canpay_bail = false;
    if (_this select 0) then {
        sleep (10 * 60);
    } else {
        sleep (5 * 60);
    };
    life_canpay_bail = true;
};

for "_i" from 0 to 1 step 0 do {
    if ((round(_time - time)) > 0) then {
        _countDown = [(_time - time),"MM:SS.MS"] call BIS_fnc_secondsToString;
        hintSilent parseText format [(localize "STR_Jail_Time")+ "<br/> <t size='2'><t color='#FF0000'>%1</t></t><br/><br/>" +(localize "STR_Jail_Pay")+ " %3<br/>" +(localize "STR_Jail_Price")+ " $%2",_countDown,[life_bail_amount] call life_fnc_numberText,if (life_canpay_bail) then {"Yes"} else {"No"}];
    };

    if (LIFE_SETTINGS(getNumber,"jail_forceWalk") isEqualTo 1) then {
        player forceWalk true;
    };

    private _escDist = [[["Altis", 60], ["Tanoa", 145]]] call TON_fnc_terrainSort;
    
    if (player distance (getMarkerPos "jail_marker") > _escDist) exitWith {
        _esc = true;
    };

    if (life_bail_paid) exitWith {
        _bail = true;
    };

    if ((round(_time - time)) < 1) exitWith {hint ""};
    if (!alive player && ((round(_time - time)) > 0)) exitWith {};
    sleep 0.1;
};

//Begin jail uniform
hint "Your gear has been placed in the evidence locker!";
old_gear = getUnitLoadout player;
removeUniform player;
removeHeadgear player;
removeVest player;
removeGoggles player;
removeBackpack player;
removeallWeapons player;
removeallAssignedItems player;
player addUniform "mgsr_robe_dirty";


switch (true) do {
    case (_bail): {
        life_is_arrested = false;
        life_bail_paid = false;

        hint localize "STR_Jail_Paid";
        player setPos (getMarkerPos "jail_release");

        if (life_HC_isActive) then {
            [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
        } else {
            [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
        };
        player setUnitLoadout old_gear;
        hint "Because you have done your time in prison, you will recieve your clothing shortly";
        [] call life_fnc_saveGear;
        [5] call SOCK_fnc_updatePartial;
    };

    case (_esc): {
        life_is_arrested = false;
        hint localize "STR_Jail_EscapeSelf";
        [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];

        if (life_HC_isActive) then {
            [getPlayerUID player,profileName,"901"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
        } else {
            [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
        };
         hint "Because you escaped from jail, the jail guards have placed your gear in the trash";
         [] call life_fnc_saveGear;

        [5] call SOCK_fnc_updatePartial;
    };

    case (alive player && !_esc && !_bail): {
        life_is_arrested = false;
        hint localize "STR_Jail_Released";

        if (life_HC_isActive) then {
            [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
        } else {
            [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
        };
        player setUnitLoadout old_gear;
        hint "Because you have done your time in prison, you will recieve your clothing shortly";
        [] call life_fnc_saveGear;
        player setPos (getMarkerPos "jail_release");
        [5] call SOCK_fnc_updatePartial;
    };
};

player forceWalk false; // Enable running & jumping

 

tried it but it still didnt work :/    It adds the uniform to the player when they escape.

Edited by TwisT

Share this post


Link to post
Share on other sites
Just now, Deadlesszombie said:

What is the issue?

When I send someone to jail, it keeps their clothes on. But when they escape it adds the uniform.

  • Like 1

Share this post


Link to post
Share on other sites

Maybe try moving my code higher in the file?

It works very simply

go to jail, get uniform

Escape and you DO NOT GET YOUR GEAR

pay bail you get get it back

Do your time you get it back

?

Share this post


Link to post
Share on other sites
2 minutes ago, TwisT said:

When I send someone to jail, it keeps their clothes on. But when they escape it adds the uniform.

Move the uniform code higher below the param and tell me if it still occurs

 

Edited by Deadlesszombie

Share this post


Link to post
Share on other sites

Should I add above this ?

if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };

if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
_esc = false;
_bail = false;

[_bad] spawn {
    life_canpay_bail = false;
    if (_this select 0) then {
        sleep (10 * 60);
    } else {
        sleep (5 * 60);
    };
    life_canpay_bail = true;
};

Share this post


Link to post
Share on other sites

Hi man, good day. So you saing i have to move the code up to  

if ((round(_time - time)) < 1) exitWith {hint ""};
    if (!alive player && ((round(_time - time)) > 0)) exitWith {};
    sleep 0.1;

after sleep 0.1 

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, DesusaED said:

Hi man, good day. So you saing i have to move the code up to  

if ((round(_time - time)) < 1) exitWith {hint ""};
    if (!alive player && ((round(_time - time)) > 0)) exitWith {};
    sleep 0.1;

after sleep 0.1 

 

9 minutes ago, Deadlesszombie said:

below the param

 

Share this post


Link to post
Share on other sites
8 minutes ago, TwisT said:

Should I add above this ?

if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };

if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
_esc = false;
_bail = false;

[_bad] spawn {
    life_canpay_bail = false;
    if (_this select 0) then {
        sleep (10 * 60);
    } else {
        sleep (5 * 60);
    };
    life_canpay_bail = true;
};

Yes

Share this post


Link to post
Share on other sites

The script is untested but works in theory as mentioned in the main post, my code to adding the clothes works fine even if you had a normal arma mission, its just issue with the jail functions I presume 

Share this post


Link to post
Share on other sites
6 hours ago, TwisT said:

#include "..\..\script_macros.hpp" /* File: fn_jailMe.sqf Author Bryan "Tonic" Boardwine Description: Once word is received by the server the rest of the jail execution is completed. */ private ["_time","_bail","_esc","_countDown"]; params [ ["_ret",[],[[]]], ["_bad",false,[false]] ]; if

Man its the first thing in the code

Params [

 

After that blob put below it

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×