DayZ 1.8.0.3 handcuff player help

I think I'm about ready to release a more updated version of the script. Fixes the teleport for vehicles, instead when you enter a vehicle it will drop the player back into the sitting animation and detach them from you rather then them standing there and teleported back to you once you get out.

Also it will add a check that will always run checking if someone has been detained. Has a 600 second timer for the person being arrested do they know how long they have left till they are released. Logging out and back in will reset them in the sitting position and reset the timer back to 600 (hopefully will deter people from relogging trying to get out). Timer ends when player is released or once timer gets to 0. Should also fix arresting players in buildings where they are teleported to the ground.
 
I've only tested this on 1.8.0.3 currently and I have updated this with only players being arrested in mind. You need a custom compiles and fn_selfactions. You will also need the files from here:
https://www.dropbox.com/s/n6h3xgg72275mhw/Arrest_V2.rar

Assuming you have a custom compiles and fn_selfaction.sqf start at step 2

Step 1:
Create a custom folder in your mission pbo. You will then need to obtain your compiles and fn_selfaction from your Dayz_Code.pbo. Drag them both into your new custom folder in you mission pbo.
Open up you init.sqf and look for this line:
Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";
change this line to:
Code:
call compile preprocessFileLineNumbers "custom\compiles.sqf";

Next you will need to open you compiles.sqf in custom\compiles.sqf.
find the line that looks like this:
Code:
fnc_usec_selfActions = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";
and change it to:
Code:
fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";

This will make the compiles.sqf and fn_selfaction.sqf client sided.

Step 2.
Open up your fn_selfaction and find the code that looks similar to this or has the comment mark that looks like this:
Code:
//Allow player to force save
    if((_isVehicle or _isTent or _isStash or _isMediumStash) and _canDo and !_isMan and (damage _cursorTarget < 1)) then {
        if (s_player_forceSave < 0) then {
            s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
        };
    } else {
        player removeAction s_player_forceSave;
        s_player_forceSave = -1;
    };

Above the Allow player to force save line we will be adding the arrest script. Above you will need to add this:
Code:
    //--------------------------------------ARREST----------------------------------------------------------------
    _side = side _cursorTarget == west; //so only Players can be detained
    _arrestreq = "PartGeneric" in magazines player;    // CHANGE THIS TO THE ITEM YOU WANT PLAYERS TO NEED TO BE ABLE TO ARREST
    if (player getVariable "Detain" == 1) then {
    player removeAction s_player_arrest;
    };
        if(_isMan && !_isZombie && _canDo && _isAlive && !_isAnimal && _arrestreq && _side) then {
        if (_cursorTarget getVariable "Detain" == 1) exitWith {};
            if (s_player_arrest < 0) then {
                s_player_arrest = player addaction [("<t color=""#0074E8"">" + ("Detain") +"</t>"), "arrest\Detain.sqf",_cursorTarget,100,false,true,"", ""];
                };
        } else {
            player removeAction s_player_arrest;
            s_player_arrest = -1;
            };
    if ((_cursorTarget getVariable "Detain" == 1) && cursorTarget distance player < 2 ) then
    {
        if(_isMan && !_isZombie && _canDo && _isAlive) then {
            if (s_player_escort < 0) then {
                s_player_escort = player addaction [("<t color=""#0074E8"">" + ("Escort") +"</t>"), "arrest\Escort.sqf",_cursorTarget, 1, true, true, "", ""];
                };
        } else {
            player removeAction s_player_escort;
            s_player_escort = -1;
            };
        if(_isMan && !_isZombie && _canDo && _isAlive) then {
            if (s_player_search < 0) then {
                s_player_search = player addaction [("<t color=""#0074E8"">" + ("Search") +"</t>"), "arrest\Search.sqf",_cursorTarget, 1, true, true, "", ""];
                };
        } else {
            player removeAction s_player_search;
            s_player_search = -1;
            };

        if(_isMan && !_isZombie && _canDo && _isAlive) then {
            if (s_player_release < 0) then {
                s_player_release = player addaction [("<t color=""#0074E8"">" + ("Release") +"</t>"), "arrest\release.sqf",_cursorTarget, 1, true, true, "", ""];
                };
        } else {
            player removeAction s_player_release;
            s_player_release = -1;
            };
    };
    //-------------------------------------------------------------------------------------------------------------

You will need to edit the required item to your liking. The default is scarp metal.
Then near the bottom of fn_selfactions.sqf you will need to add this:
Code:
//Arrest
    player removeAction s_player_arrest;
    s_player_arrest = -1;
    player removeAction s_player_release;
    s_player_release = -1;
    player removeAction s_player_escort;
    s_player_escort = -1;
    player removeAction s_player_search;
    s_player_search = -1;
right above this:
Code:
//Others
    player removeAction s_player_forceSave;
    s_player_forceSave = -1;
Step 3.

Open up your init.sqf again and add this at the very bottom of it:
Code:
_nul = [] execVM "detaincheck.sqf";

You will then need to copy the detaincheck.sqf to the main folder of you mission pbo.

You will also need to copy the arrest folder to the main folder of you mission pbo.

Your mission folder then should have:
init.sqf, description.ext, mission.sqm, arrest\detain.sqf, arrest\release.sqf, arrest\search.sqf, arrest\escort.sqf, custom\compiles.sqf, custom\fn_selfaction.sqf, and detaincheck.sqf (+anything else you've added)

Future release will have load in option.

This version fixes bugs with escort, and globalizes detain when re-logging.
 
Last edited:
How to make only hero's be able to use the menu?
This might work.
Code:
if(_isMan && !_isZombie && ((player getVariable "humanity") >= 5000) && _canDo && _isAlive && !_isAnimal && _arrestreq && _side) then {
if (_cursorTarget getVariable "Detain" == 1) exitWith {};
if (s_player_arrest < 0) then {
s_player_arrest = player addaction [("<t color=""#0074E8"">" + ("Detain") +"</t>"), "arrest\Detain.sqf",_cursorTarget,100,false,true,"", ""];
};
} else {
player removeAction s_player_arrest;
s_player_arrest = -1;
};

This would make only heroes with the required items can detain. You can remove the _arrestreq to remove the requirement.
 
Where do i put it?
You'd copy it over the detain portion in fn_selfactions.
Code:
//--------------------------------------ARREST----------------------------------------------------------------
_side = side _cursorTarget == west; //so only Players can be detained
_arrestreq = "PartGeneric" in magazines player; // CHANGE THIS TO THE ITEM YOU WANT PLAYERS TO NEED TO BE ABLE TO ARREST
if (player getVariable "Detain" == 1) then {
player removeAction s_player_arrest;
};
if(_isMan && !_isZombie && ((player getVariable "humanity") >= 5000) && _canDo && _isAlive && !_isAnimal && _arrestreq && _side) then {
if (_cursorTarget getVariable "Detain" == 1) exitWith {};
if (s_player_arrest < 0) then {
s_player_arrest = player addaction [("<t color=""#0074E8"">" + ("Detain") +"</t>"), "arrest\Detain.sqf",_cursorTarget,100,false,true,"", ""];
};
} else {
player removeAction s_player_arrest;
s_player_arrest = -1;
};
if ((_cursorTarget getVariable "Detain" == 1) && cursorTarget distance player < 2 ) then
{
if(_isMan && !_isZombie && _canDo && _isAlive) then {
if (s_player_escort < 0) then {
s_player_escort = player addaction [("<t color=""#0074E8"">" + ("Escort") +"</t>"), "arrest\Escort.sqf",_cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_escort;
s_player_escort = -1;
};
if(_isMan && !_isZombie && _canDo && _isAlive) then {
if (s_player_search < 0) then {
s_player_search = player addaction [("<t color=""#0074E8"">" + ("Search") +"</t>"), "arrest\Search.sqf",_cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_search;
s_player_search = -1;
};

if(_isMan && !_isZombie && _canDo && _isAlive) then {
if (s_player_release < 0) then {
s_player_release = player addaction [("<t color=""#0074E8"">" + ("Release") +"</t>"), "arrest\release.sqf",_cursorTarget, 1, true, true, "", ""];
};
} else {
player removeAction s_player_release;
s_player_release = -1;
};
};
//-------------------------------------------------------------------------------------------------------------
 
Will i have to put
if(_isMan && !_isZombie && ((player getVariable "humanity") >= 5000) && _canDo && _isAlive && !_isAnimal && _arrestreq && _side) then {
in front of every feature so only heros can use it?
 
if you want heroes to only get the option then yes, with what I gave you only heroes can detain but then anyone can come along and search them/escort them.
 
Just a suggestion maybe you should make it into a menu instead of scrolling and having 6 different options to scroll thru to get to open backpack or somthing and add a humanity option
 
Just a suggestion maybe you should make it into a menu instead of scrolling and having 6 different options to scroll thru to get to open backpack or somthing and add a humanity option
The way its setup the most options you could ever have is 4. The menu is setup the way it is so that once someone is arrested everyone can come up to that player and get the options.
 
Back
Top