Jump to content

Restrain player

Recommended Posts

This is a script to restrain a player you stand close to (needs a rope - until i find a better solution like handcuffs/zipties)

all credits go to @He-Man Thank you for your support again

The link to the action-pic and the prepared script is here:



in init.sqf add


 restraincheck = compileFinal  preprocessFileLineNumbers "addons\restrain\restraincheck.sqf";
restrain = compileFinal  preprocessFileLineNumbers "addons\restrain\restrain.sqf"; 

in CfgRemoteExec.hpp add


	    class restrain {
      jip = 0;

in CfgActionMenu_target.hpp add


 class restrainPlayer
    condition = "dyna_isPlayer && (damage dyna_cursorTarget < 1) && !(dyna_cursorTarget getvariable ['restrain',false])";
    action= "if !('ItemRope' in magazines player) exitwith {['Get a rope to restrain a player!',5] call Epoch_Message;};player removeitem 'ItemRope';dyna_cursorTarget call restraincheck;";
    icon = "addons\pics\Actions\restrain.paa";
    tooltip = "Restrain player";
class unrestrainPlayer
    condition = "dyna_isPlayer && (damage dyna_cursorTarget < 1) && dyna_cursorTarget getvariable ['restrain',false]";
    action= "dyna_cursorTarget call restraincheck;";
    icon = "addons\pics\Actions\restrain.paa";
    tooltip = "UnRestrain player";

in addons\restrain\restrain.sqf write


 params ["_target","_caller","_isrestrained"];
if !(player isEqualTo _target) exitwith {};
if (_target isEqualTo _caller) exitwith {};
if (_target distance _caller > 10) exitwith {};
if (vehicle player != player) exitwith {['Restrain warning!', 5] call Epoch_message;};
if (_isrestrained) then {
    player setVariable ["restrain", false, true];
else {
    player setVariable ["restrain", true, true];
    [] spawn {
        _pos = getposatl player;
        while {player getVariable ["restrain", false]}  do {
            player playMove "AmovPercMstpSnonWnonDnon_EaseIn"; //Animation in
            player setposatl _pos;            
            if (((!alive player) || (player getVariable["onkill",FALSE]))) then {
                player setVariable ["restrain", false, true];
        player playMoveNow "AmovPercMstpSnonWnonDnon_EaseOut"; //Animation out


and in addons\restrain\restraincheck.sqf write


 _target = _this;
_isrestrained = _target getVariable ["restrain", false];
[_target,player,_isrestrained] remoteexec ["restrain",_target];


Share this post

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.

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.


  • Advertisement
  • Supporters
  • Discord

  • Create New...