Jump to content

[Release] Remote key for locking/unlocking vehicles (0.3)


Recommended Posts

i

 

class CfgSounds
{
sounds[] =
{
        carLock,track1,track2,track3,track4
};
class carLock
{
        name="carLock";
        sound[]={carlock.ogg,0.9,1};
        titles[] = {};
};
class track1
{
  name="track1";
  sound[]={"sound\track1.ogg",0.05,1};
  titles[]={};
};
class track2
{
  name="track2";
  sound[]={"sound\track2.ogg",0.05,1};
  titles[]={};
  };
class track3
{
  name="track3";
  sound[]={"sound\track3.ogg",0.05,1};
  titles[]={};
};
class track4
{
  name="track4";
  sound[]={"sound\track4.ogg",0.05,1};
  titles[]={};
    };
};

 

I AM THANK YOU!!!

Link to comment
Share on other sites

David any news on this one? Earlier you talked about redoing it, dont think there is much need for that but would be awesome if:

  • You are able to spin up chopper that haven't been entered yet
  • Car vehicle keys do not get the options to start engine (or maybe just rename to "start helicopter engine" to avoid confusion)
Link to comment
Share on other sites

I actually got a pm from TheVampire a while ago with a better approach on remote starting engines:

private ["_ownerID","_objects","_i","_ownerID2","_vehicle","_driver","_aigroup];
_ownerID = _this select 0;

_objects = nearestObjects [getPos player, ["LandVehicle","Helicopter","Plane","Ship"], 50];
_i = 0;
{
	_vehicle = _x;
	if (alive _vehicle) then {
		_ownerID2 = _vehicle getVariable ["CharacterID", "0"];

		if(_ownerID == _ownerID2) then {
			if(!locked _vehicle) then {
				if(player distance _vehicle < 50) then {
					DZE_ActionInProgress = true;
					
					if (isEngineOn _vehicle) then {
						_vehicle engineOn false;
					} else {
						_vehicle engineOn true;
					};
					
					DZE_ActionInProgress = false;
				};
			};
		};
		
		_i = _i + 1;
	};
} forEach _objects;

The new version is still in active development.

Link to comment
Share on other sites

I actually got a pm from TheVampire a while ago with a better approach on remote starting engines:

private ["_ownerID","_objects","_i","_ownerID2","_vehicle","_driver","_aigroup"];
_ownerID = _this select 0;

_objects = nearestObjects [getPos player, ["LandVehicle","Helicopter","Plane","Ship"], 50];
_i = 0;
{
	_vehicle = _x;
	if (alive _vehicle) then {
		_ownerID2 = _vehicle getVariable ["CharacterID", "0"];

		if(_ownerID == _ownerID2) then {
			if(!locked _vehicle) then {
				if(player distance _vehicle < 50) then {
					DZE_ActionInProgress = true;
					
					if (isEngineOn _vehicle) then {
						_vehicle engineOn false;
					} else {
						_vehicle engineOn true;
					};
					
					DZE_ActionInProgress = false;
				};
			};
		};
		
		_i = _i + 1;
	};
} forEach _objects;

The new version is still in active development.

 

 

Good to hear its still in developement, big fan of this one!

 

TheVampires code does not fix the remote engine start btw. When you haven't been in the chopper it will fire up briefly but then quickly shut down again.

Link to comment
Share on other sites

Don't know if someone else has posted this but here goes. If someone else has posted it, sorry and will delete it off.
 
If you would like to get this working along with mudzereli's deploy bicycle script. It is pretty simple to do
 
1) In mission files go to "overwrites\click_actions\init.sqf" and change it to the code below:

// this baby only runs client side

if(isServer) exitWith {};
// only let this dependency be instantiated once
if(isNil "DZE_CLICK_ACTIONS_BUILD") then {
    diag_log text "CLICK ACTIONS: loading...";
    // our fancy array of registered actions
    DZE_CLICK_ACTIONS = [];
    // overwrite the selectslot function with our hooked version
    player_selectSlot = compile preprocessFileLineNumbers "custom\player_selectSlot.sqf";
    // let other addons know we're loaded
    DZE_CLICK_ACTIONS_BUILD = 2;

};

 

Just make sure you point it to the correct location of your "custom\player_selectSlot.sqf" file, that was made with the deploy bike script.

 

2)Now we need to add the code from "overwrites\click_actions\ui_selectSlot.sqf" and slot it into your "custom\playerselectSlot.sqf"

 

take this part of the code:

  //### BEGIN MODIFIED CODE: extra click actions

    {
        private["_className","_displayText","_scriptCall"];
        _className   = _x select 0;
        _displayText = _x select 1;
        _scriptCall  = _x select 2;
        // if the clicked item matches, then assign the script call and display text
        if(_item == _className) then {
            _menu = _parent displayCtrl (1600 + _numActions);
            _menu ctrlShow true;
            _height = _height + (0.025 * safezoneH);
            uiNamespace setVariable ['uiControl', _control];
            _menu ctrlSetText _displayText;
            _menu ctrlSetEventHandler ["ButtonClick",_scriptCall];
            _numActions = _numActions + 1;
        };
    } forEach DZE_CLICK_ACTIONS;
    //### END MODIFIED CODE: extra click actions

 
and place it above this line "_pos set [3,_height];" in the "custom\player_selectSlot.sqf"
 
Then you should be all good to go. Not very good at writing guides, so go easy on me!
Link to comment
Share on other sites

OK so i have this mostly working. i have installed the script like you had originally showed and then made the changes so that the sound only plays when you lock/unlock with the remote and i made a small change so that the lock uses the one beep sound file and the unlock uses the two beep sound. other than that i think i have left everything else alone but i am still not seeing the lights turn on and off when i do these things so in order to try to figure this out i got in a few different vehicles to make sure there was an option to turn on the lights manually but there is not... any clue where i should be looking to figure out why? the only other things on my server are custom loadouts which dont reference anything to do with lights and a custom debug monitor which also should have nothing to do with lights...

 

EDIT: Ok i guess it works now... i dont think i changed anything but the lights definitely come on when it beeps now so cool good work on the script!

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

I am currently already overriding local_lockunlock to disable R3Farty lift and tow on locked vehicles so my file looks like this:

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;
 
if (local _vehicle) then {
if(_status) then {
_vehicle setVehicleLock "LOCKED";
_vehicle setVariable ["R3F_LOG_disabled",true,true];
} else {
_vehicle setVehicleLock "UNLOCKED";
_vehicle setVariable ["R3F_LOG_disabled",false,true];
};
};

 
Can you tell me what it should look like when merged?
 
Thanks
Link to comment
Share on other sites

 

I am currently already overriding local_lockunlock to disable R3Farty lift and tow on locked vehicles so my file looks like this:

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;
 
if (local _vehicle) then {
if(_status) then {
_vehicle setVehicleLock "LOCKED";
_vehicle setVariable ["R3F_LOG_disabled",true,true];
} else {
_vehicle setVehicleLock "UNLOCKED";
_vehicle setVariable ["R3F_LOG_disabled",false,true];
};
};

 
Can you tell me what it should look like when merged?
 
Thanks

 

can anyone help? Thanks

Link to comment
Share on other sites

can anyone help? Thanks

 

Replace your local_lockUnlock with this:

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
	_vehicle setVehicleLock (if (_status) then { "LOCKED" } else { "UNLOCKED" });
	_vehicle setVariable ["R3F_LOG_disabled", _status, true];
	player action ["lightOn", _vehicle];
	[objNull, _vehicle, rSAY, "CarLock", 20] call RE;
	uiSleep 0.5;
	player action ["lightOff", _vehicle];
};
Link to comment
Share on other sites

 

Replace your local_lockUnlock with this:

private ["_vehicle","_status"];
_vehicle = _this select 0;
_status = _this select 1;

if (local _vehicle) then {
	_vehicle setVehicleLock (if (_status) then { "LOCKED" } else { "UNLOCKED" });
	_vehicle setVariable ["R3F_LOG_disabled", _status, true];
	player action ["lightOn", _vehicle];
	[objNull, _vehicle, rSAY, "CarLock", 20] call RE;
	uiSleep 0.5;
	player action ["lightOff", _vehicle];
};

Thanks! :)

Link to comment
Share on other sites

It sounds like you have missed the step 1 of the original post.

The functions you need to replace are ui_selectSlot and fn_gearMenuChecks. Normally, these point to sqf files in the dayz_code pbo.

 

player_selectSlot =			compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";
fn_gearMenuChecks =			compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf";
These functions need to point to the files in the mission file:

player_selectSlot =			compile preprocessFileLineNumbers "custom\player_selectSlot.sqf";
fn_gearMenuChecks =			compile preprocessFileLineNumbers "custom\fn_gearMenuChecks.sqf";
I hope this will point you in the right direction.

I am working on a complete re-write of this that will be a lot simpler to install, if you cant get this to work you may try the experimental new version.

 

Hi David, unless I'm being blind those modified calls above to the new overridden files aren't in your original post....? Could be where people are getting stuck...

Link to comment
Share on other sites

  • 3 weeks later...

please someone help me !!

this my files:

descreption.ext:

 

class RscPicture
{
    access=0;
    type=0;
    idc=-1;
    style=48;
    colorBackground[]={0,0,0,0};
    colorText[]={1,1,1,1};
    font="TahomaB";
    sizeEx=0;
    lineSpacing=0;
    text="";
};
class CfgSounds
{
    sounds[] =
    {
  carLock
    };
    class carLock
    {
  name="carLock";
  sound[]={carlock.ogg,0.9,1};
  titles[] = {};
    };
};
class RscLoadingText : RscText
{
    style = 2;
    x = 0.323532;
    y = 0.666672;
    w = 0.352944;
    h = 0.039216;
    sizeEx = 0.03921;
    colorText[] = {0.543,0.5742,0.4102,1.0};
};

 

local_lockunlock:

 

private ["_vehicle","_status","_sounddist"];
_vehicle = _this select 0;
_status = _this select 1;
_sounddist = 20;

if (local _vehicle) then {
    if(_status) then {
        _vehicle setVehicleLock "LOCKED";
        _vehicle setVariable ["R3F_LOG_disabled",true,true];
        _vehicle allowDamage false;
        _vehicle enableSimulation true;
        player action ["lightOn", _vehicle];
        _nul = [objNull, _vehicle, rSAY, "CarLock", 20] call RE;
        sleep 0.5;
        player action ["lightOff", _vehicle];
        titleText ["CERRADO = No puedes Remolcar","PLAIN DOWN"]; titleFadeOut 4;
    } else {
        _vehicle setVehicleLock "UNLOCKED";
        _vehicle setVariable ["R3F_LOG_disabled",false,true];
        _vehicle allowDamage true;
        _vehicle enableSimulation true;
        player action ["lightOn", _vehicle];
        _nul = [objNull, _vehicle, rSAY, "CarLock", 20] call RE;
        sleep 0.5;
        player action ["lightOff", _vehicle];
        titleText ["ABIERTO = Puedes Remolcar","PLAIN DOWN"]; titleFadeOut 4;
    };
 

Link to comment
Share on other sites

What you want to do is to completely skip the changes to local_unlock and instead put the code in remote_lock.sqf and remote_unlock.sqf.

In each of these files, find the line:

 

PVDZE_veh_Lock spawn local_lockUnlock
Replace it with this:

		PVDZE_veh_Lock spawn local_lockUnlock;
		player action ["lightOn", _vehicle];
		_nul = [objNull, _vehicle, rSAY, "carLock", _sounddist] call RE;
		sleep 0.5;
		player action ["lightOff", _vehicle];

 

With this approach you will only get sound after you've been in the driver seat. Any idea how to fix this?

 

 changing the ui_selectslot.sqf to player_selectslot.sqf breaks my maca right click options  or im doing something wrong and cannot figure out what any help be great

 

You do not need to rename the file.

Link to comment
Share on other sites

  • 3 weeks later...

@David: to your post here:

 

To close the gear menu directly after using the right click option, add this at the very end of the files remote_lock.sqf, remote_unlock.sqf and engine script.

 

if (!IsNull (FindDisplay 106)) then {
                closeDialog 0;
}

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

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
  • Advertisement
×
×
  • Create New...