Jump to content
Mukstar

Admin restrain player via button

Recommended Posts

Hi i am running Altis Life v5.0.0.0

I am setting up my admin menu with buttons so the admins have access to functions fast.

I am looking for a way for the admins to restrain a player via the button. Much like how the cops do - without the need for zipties.

I have a button setup in my admin menu

Thank you

Share this post


Link to post
Share on other sites

@Mukstar You only need to create one topic and add all your questions to it. I will answer all your questions here.
restrain player via button Look at the function that restrains a player then adapt it to the button.
revive player via button Look at the function that revives a player then adapt it to the button.
impound Vehicle via button Look at the function that impounds vehicles then adapt it to the button.
Invisible toggle function via button Have you googled "Arma 3 how to make players invisible"?
Setting Player max bank accounts Create a script that checks the player's money every 5ish minutes using an if statement if true reduce their bank balance to a set value.

Edited by Fawks

Share this post


Link to post
Share on other sites

Hi, Thanks for the reply, sorry for multi-posting i thought as they were different things i'd make different ones.

I have set up a zipties, gag and blindfold system but would like the admin to be able to restrain without the need for zipties.

Yes i have googled all of the above mentioned tasks over the last 3 weeks, what i have tried -

Restrain player - i have tried to call the police fn_restrain.sqf from the button - I will try again to customise the script as you suggested.

Revive player - Tried to call the medic fn_reviveplayer.sqf - I will try again to customise the script as you suggested.

Invisible - [player,true] remoteExec ["hideObjectGlobal",2,false];

Impound vehicle -  i have tried to call the fn_impoundAction.sqf from the button

I have tried to adapt this script but i keep breaking it - 

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

    Description:
    Impounds the vehicle
*/
private ["_vehicle","_type","_time","_value","_vehicleData","_upp","_ui","_progress","_pgText","_cP","_filters","_impoundValue","_price","_impoundMultiplier"];
_vehicle = param [0,objNull,[objNull]];
_filters = ["Car","Air","Ship"];
if (!((KINDOF_ARRAY(_vehicle,_filters)))) exitWith {};
if (player distance cursorObject > 10) exitWith {};
if (_vehicle getVariable "NPC") exitWith {hint localize "STR_NPC_Protected"};

_vehicleData = _vehicle getVariable ["vehicle_info_owners",[]];
if (_vehicleData isEqualTo 0) exitWith {deleteVehicle _vehicle}; //Bad vehicle.
_vehicleName = FETCH_CONFIG2(getText,"CfgVehicles",(typeOf _vehicle),"displayName");
_price = M_CONFIG(getNumber,"LifeCfgVehicles",(typeOf _vehicle),"price");
[0,"STR_NOTF_BeingImpounded",true,[((_vehicleData select 0) select 1),_vehicleName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
life_action_inUse = true;

_upp = localize "STR_NOTF_Impounding";
//Setup our progress bar.
disableSerialization;
"progressBar" cutRsc ["life_progress","PLAIN"];
_ui = uiNamespace getVariable "life_progress";
_progress = _ui displayCtrl 38201;
_pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format ["%2 (1%1)...","%",_upp];
_progress progressSetPosition 0.01;
_cP = 0.01;

for "_i" from 0 to 1 step 0 do {
    uiSleep 0.09;
    _cP = _cP + 0.01;
    _progress progressSetPosition _cP;
    _pgText ctrlSetText format ["%3 (%1%2)...",round(_cP * 100),"%",_upp];
    if (_cP >= 1) exitWith {};
    if (player distance _vehicle > 10) exitWith {};
    if (!alive player) exitWith {};
};

"progressBar" cutText ["","PLAIN"];

if (player distance _vehicle > 10) exitWith {hint localize "STR_NOTF_ImpoundingCancelled"; life_action_inUse = false;};
if (!alive player) exitWith {life_action_inUse = false;};

if (count crew _vehicle isEqualTo 0) then {
    if (!(KINDOF_ARRAY(_vehicle,_filters))) exitWith {life_action_inUse = false;};
    _type = FETCH_CONFIG2(getText,"CfgVehicles",(typeOf _vehicle),"displayName");

    life_impound_inuse = true;

    if (life_HC_isActive) then {
        [_vehicle,true,player] remoteExec ["HC_fnc_vehicleStore",HC_Life];
    } else {
        [_vehicle,true,player] remoteExec ["TON_fnc_vehicleStore",RSERV];
    };

    waitUntil {!life_impound_inuse};
    if (playerSide isEqualTo west) then {
            _impoundMultiplier = LIFE_SETTINGS(getNumber,"vehicle_cop_impound_multiplier");
            _value = _price * _impoundMultiplier;
            [0,"STR_NOTF_HasImpounded",true,[profileName,((_vehicleData select 0) select 1),_vehicleName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
            if (_vehicle in life_vehicles) then {
                hint format [localize "STR_NOTF_OwnImpounded",[_value] call life_fnc_numberText,_type];
                BANK = BANK - _value;
            } else {
                hint format [localize "STR_NOTF_Impounded",_type,[_value] call life_fnc_numberText];
                BANK = BANK + _value;
            };
            if (BANK < 0) then {BANK = 0;};
            [1] call SOCK_fnc_updatePartial;
    };
} else {
    hint localize "STR_NOTF_ImpoundingCancelled";
};

life_action_inUse = false;

 

Button - 

        class impoundVehicle : Life_RscButtonMenu {
            idc = 2918;
            text = "Impound";
            onButtonClick = "[] call life_fnc_adminImpoundAction";
            x = 0.54125 * safezoneW + safezoneX;
            y = 0.715 * safezoneH + safezoneY
            w = 0.0680 * safezoneW;
            h = 0.035 * safezoneH;
        };
 

Edited by Mukstar
added button code

Share this post


Link to post
Share on other sites

Trying to think outside the box - in the actionkeyhandler.sqf  where the cops get the cop menu on win key i added this (admin check) for the admins - 

 

//If target is a player then check if we can use the cop menu.
if (isPlayer _curObject && _curObject isKindOf "CAManBase") then {
    if ((_curObject getVariable ["restrained",false]) && !dialog && playerSide isEqualTo west || (FETCH_CONST(life_adminlevel) > 1)) then {
        [_curObject] call life_fnc_copInteractionMenu;
    };

        if ((!(_curObject getVariable ["restrained",false])) && !dialog && playerSide isEqualTo civilian) then {
        [_curObject] call life_fnc_copInteractionMenu;
    };

Edited by Mukstar

Share this post


Link to post
Share on other sites

in the admin_menu.hpp added this to the button to try and avoid the playerSide isEqualTo west check in the actionkeyhandler.sqf - it just closes the dialog - 

 

        class impoundVehicle : Life_RscButtonMenu {
            idc = 2918;
            text = "Impound";
            onButtonClick = "[] call life_fnc_copInteractionMenu; closeDialog 0;";
            x = 0.54125 * safezoneW + safezoneX;
            y = 0.715 * safezoneH + safezoneY
            w = 0.0680 * safezoneW;
            h = 0.035 * safezoneH;
        };

Share this post


Link to post
Share on other sites
#include <macro.h>
/*
	File: fn_adminFreeze.sqf
	Author: ColinM9991
 
	Description: Freezes selected player
*/
if(__GETC__(life_adminlevel) < 2) exitWith {closeDialog 0; _string = localize "STR_ANOTF_ErrorLevel"; /*life_HUD_Notifs pushBack [_string,time,0];*/};

private["_unit"];
_unit = lbData[76020,lbCurSel (76020)];
_unit = call compile format["%1", _unit];
if(isNil "_unit") exitWith {};
if(isNull _unit) exitWith {};
if(_unit == player) exitWith {_string = localize "STR_ANOTF_Error"; life_HUD_Notifs pushBack [_string,time,20];};

[[player],"life_fnc_freezePlayer",_unit,false] spawn life_fnc_MP; 

This file (by ColinM9991) is a better admin function for what you're trying to do.

Freezing a player prohibits their ability to have any input whatsoever. Meaning they can't simply quit to escape punishment if you need to apply warnings or infractions to their account.

The other side of the action is this;

#include <macro.h>
/*
	File: fn_freezePlayer.sqf
	Author: ColinM9991
 
	Description: Freezes selected player
*/
private["_admin"];
_admin = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;

if(life_frozen) then {
	_string = localize "STR_NOTF_Unfrozen";
	life_hud_notifs pushback [_string,time,20];
	//[[format[localize "STR_ANOTF_Unfrozen",profileName],20],"life_fnc_broadcastHUD",_admin,false] spawn life_fnc_MP;
	disableUserInput false;
	life_frozen = false;
} else {
	_string = localize "STR_NOTF_Frozen";
	life_hud_notifs pushback [_string,time];
	//[[format[localize "STR_ANOTF_Frozen",profileName],20],"life_fnc_broadcastHUD",_admin,false] spawn life_fnc_MP;
	disableUserInput true;
	life_frozen = true;
};

I've taken this from my server, so "life_hud_notifs" and "life_fnc_broadcastHUD" need to be amended to your specific server configurations for sending player messages (basically my system replaces "hint" so that it's stackable)

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.

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.