Jump to content

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 impound a Vehicle via the button.

Impound rather than destroy as the players will lose their vehicles.

 

I have a button setup in my admin menu.

 

Thank you

Share this post


Link to post
Share on other sites

Hello @Steel_Dragon.

 

I'm not familiar with Altis Life but I will try to help if I can.

What have you got so far?

 

 

 

Edited by Maff
Spelling fix.
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi thanks for the reply - This is what i have tried calling from a button

- deletevehicle cursortarget (This deletes the vehicle - but i would like it to impound instead)

-  i have tried to call the fn_impound from the button (but im guessing that there are police checks involved)

- I have tried - this [Impound vehicle, deleteVehicle car1];

none of these really work i would like to make some thing from this script below but i keep breaking it - 

 

#include "..\..\script_macros.hpp"
/*
    File: fn_impoundAction.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;
        };

 

Thanks

Edited by Steel_Dragon
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;
    };

 

If i can give the admins the cop interaction menu - the admins have access to - Impound, restrain and a few other features.

Share this post


Link to post
Share on other sites

As I don't have the whole mission I can't test anything.

I have found a Life Framework by the same author but I don't know if you have a more up to date version.


Try looking at the vehicle and in the debug console use:

[cursorObject] call TON_fnc_impoundAction;	//	TON_fnc, or whatever tag the functions are using.

 

Anything happen?

  • Thanks 1

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
8 minutes ago, Steel_Dragon said:

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;
        };

Why are you trying to bypass the playerSide isEqualTo west check? Are you not BLUFOR?

Try this:


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



Do you have a link to the mission you are using?

  • Thanks 1

Share this post


Link to post
Share on other sites
50 minutes ago, Maff said:

As I don't have the whole mission I can't test anything.

I have found a Life Framework by the same author but I don't know if you have a more up to date version.


Try looking at the vehicle and in the debug console use:


[cursorObject] call TON_fnc_impoundAction;	//	TON_fnc, or whatever tag the functions are using.

 

Anything happen?

i'll give it a go now, thanks (I'm using - V5.0.0. - https://github.com/AsYetUntitled/Framework

Share this post


Link to post
Share on other sites

ok i used [cursorObject] call Life_fnc_impoundAction;

and the vehicle disappeared and returned to my garage, this is exactly what im looking for... i'll try it with the button

 

class impoundVehicle: Life_RscButtonMenu

{

idc = 2918; text = "Impound";

onButtonClick = "[cursorObject] call Life_fnc_impoundAction;";

x = 0.54125 * safezoneW + safezoneX;

y = 0.715 * safezoneH + safezoneY

w = 0.0680 * safezoneW;

h = 0.035 * safezoneH;

};

 

would it be as above?

 

Share this post


Link to post
Share on other sites
31 minutes ago, Maff said:

Why are you trying to bypass the playerSide isEqualTo west check? Are you not BLUFOR?

Try this:


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



Do you have a link to the mission you are using?

i am trying to give the cop interaction menu to the admins also - this would save having alot of buttons in the admin menu

It would give the admin - Restrain, Impound and all the other cop menu items

Share this post


Link to post
Share on other sites

class impoundVehicle: Life_RscButtonMenu

{

idc = 2918; text = "Impound";

onButtonClick = "[cursorObject] call Life_fnc_impoundAction;";

x = 0.54125 * safezoneW + safezoneX;

y = 0.715 * safezoneH + safezoneY

w = 0.0680 * safezoneW;

h = 0.035 * safezoneH;

};

 

works thank you very much for your guidance....

Share this post


Link to post
Share on other sites
17 minutes ago, Steel_Dragon said:

i am trying to give the cop interaction menu to the admins also - this would save having alot of buttons in the admin menu

It would give the admin - Restrain, Impound and all the other cop menu items

 

Ah, right.
I'm not too familiar with dialogs... I could never really get my head around them.

 

From what I understand, you need to create a new button for to open the cop interaction.

  • Thanks 1

Share this post


Link to post
Share on other sites

Yes i was just using the impound button to test it.

 

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

 

testing this one atm

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×