Beowulfv

Interior Lock & Unlock

19 posts in this topic

This adds the ability to lock and unlock vehicles from the inside with either scroll wheel functions or the Exile default hot key to lock and unlock objects.

Installation Instruction

Step 1: Open your initPlayerLocal.sqf and paste the following into it (There is an example initPlayerLocal.sqf you can use to copy from)

[] execVM "Custom\Actions\fnc_showActions.sqf";

Step 2: In your mission root open config.sqf and find class CfgExileCustomCode and insert the below

//Custom keys
ExileClient_gui_hud_event_onKeyUp = "Custom\overwrites\ExileClient_gui_hud_event_onKeyUp.sqf";

For Example:

class CfgExileCustomCode 
{	
	//Custom keys
	ExileClient_gui_hud_event_onKeyUp = "Custom\overwrites\ExileClient_gui_hud_event_onKeyUp.sqf";
};

Step 3: Edit your description.exe and add the following

class CfgFunctions
{
	#include "Custom\CfgFunctions.cpp"
};

Step 4: Place the Custom folder into your mission folder

That's it Enjoy!

Download
 

**EDIT TO CODE**
If you are looking for a way to force unlock the vehicle when the driver is killed, then you can use the following edit to do so.
 

Step 1: Open fnc_showAction.sqf located in the Actions folder.

Spoiler

[] spawn {
    while {true} do {
        waitUntil{!isNil "ExileClientLoadedIn"};
        UISleep 0.1;
        waitUntil{ExileClientLoadedIn};
        UISleep 0.1;
        waitUntil{alive player};

            LOCK_ACTION = player addAction ["<t>Lock</t>", "true spawn Exile_fnc_lock_toggle","",-10,true,true,"","vehicle player != player && locked cameraOn isEqualTo 0"];
            UNLOCK_ACTION = player addAction ["<t>Unlock</t>", "false spawn Exile_fnc_lock_toggle","",-10,true,true,"","vehicle player != player && locked cameraOn isEqualTo 2"];

        waitUntil{!alive player};
        player removeAction LOCK_ACTION;
        player removeAction UNLOCK_ACTION;
    };
};

Step 2: Make the following changes below. The original is posted above for comparison.

Spoiler

[] spawn {
    while {true} do {
        waitUntil{!isNil "ExileClientLoadedIn"};
        UISleep 0.1;
        waitUntil{ExileClientLoadedIn};
        UISleep 0.1;
        waitUntil{alive player};

            LOCK_ACTION = player addAction ["<t>Lock</t>", "true spawn Exile_fnc_lock_toggle","",-10,true,true,"","vehicle player != player && locked cameraOn isEqualTo 0"];
            UNLOCK_ACTION = player addAction ["<t>Unlock</t>", "false spawn Exile_fnc_lock_toggle","",-10,true,true,"","vehicle player != player && locked cameraOn isEqualTo 2"];

        waitUntil{!alive player};
        player removeAction LOCK_ACTION;
        player removeAction UNLOCK_ACTION;
        if (vehicle player != player && locked cameraOn isEqualTo 2) then
        {
            false spawn Exile_fnc_lock_toggle;
        };
    };
};

And you're done.

Edited by Beowulfv
  • Like 6

Share this post


Link to post
Share on other sites

Great post and nice work @Beowulfv

However, it is worth considering that whenever a player gets shot in the vehicle, the player who killed him can't then get the vehicle as a reward.... 

There is some code released somewhere which auto ejects players from vehicles as they are killed, maybe you could add that and then set the vehicle to unlock as the driver is ejected...? Just a thought but, again, nice work :) 

  • Like 2

Share this post


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

Hi, sitting inside the transport appears only the function" Lock " but it is not active, what could be the reason?

If it's unlocked, Lock will appear. If it's locked, unlock will appear. Idk what you mean by "it's not active".

Share this post


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

If it's unlocked, Lock will appear. If it's locked, unlock will appear. Idk what you mean by "it's not active".

This means that the "Lock" function itself is present in the menu, but when you click on it, nothing happens, as if it is not active

Share this post


Link to post
Share on other sites
49 minutes ago, Teacher said:

when you click on it

I have uploaded this addon to a vanilla Exile.Altis and see my error. Standby for an update to the instructions and GitHub

Edited by Beowulfv

Share this post


Link to post
Share on other sites

@Teacher Instructions on main post have been updated, missing step has been added and the file was added to the download. Please re-download the new ZIP file and follow the steps. Thank you for pointing that out.

Share this post


Link to post
Share on other sites
9 hours ago, Beowulfv said:

@Teacher Instructions on main post have been updated, missing step has been added and the file was added to the download. Please re-download the new ZIP file and follow the steps. Thank you for pointing that out.

Well, nothing, thank you for the script!

 

P.S.  Everything works like clockwork

Edited by Teacher
  • Like 1

Share this post


Link to post
Share on other sites

Just to add:
I use vector building eXpoch and it already contained a custom code for ExileClient_gui_hud_event_onKeyUp
I just did not use the overwrite of this script. I left as was without using the custom download.
It's working. Thank you

  • Like 1

Share this post


Link to post
Share on other sites
39 minutes ago, Sayago said:

Just to add:
I use vector building eXpoch and it already contained a custom code for ExileClient_gui_hud_event_onKeyUp
I just did not use the overwrite of this script. I left as was without using the custom download.
It's working. Thank you

All we are adding to that file is an extra check for a player being inside a vehicle so they can use the Exile hotkey to lock and unlock objects.
 

if (_keyCode in (actionKeys "User1")) exitWith 
{
	if (vehicle player != player) then
	{
		if !(ExileClientIsHandcuffed) then 
		{
			call Exile_fnc_vehicle_interaction_keyLock;
		};
	}else{
		if !(ExileClientIsHandcuffed) then 
		{
			call ExileClient_object_vehicle_interaction_keyLock;
		};
	};
	true
};

 

  • Like 3

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.