Jump to content

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


Recommended Posts

  • 2 weeks later...

How can i change lock/unlock distance in this cool thing?

In player_selectSlot.sqf, change:

_objects = nearestObjects [getPos player, ["LandVehicle","Helicopter","Plane","Ship"], 50];

In remote_lock.sqf and remote_unlock.sqf, change:

if(player distance _vehicle < 50) then {

Link to comment
Share on other sites

In player_selectSlot.sqf, change:

_objects = nearestObjects [getPos player, ["LandVehicle","Helicopter","Plane","Ship"], 50];

In remote_lock.sqf and remote_unlock.sqf, change:

if(player distance _vehicle < 50) then {

Looks like that didnt work. I set it to 200 and still i need to be next to car.

Link to comment
Share on other sites

I hate to post a non-descriptive request for help, but I can't seem to get this to work. I've got the car sound added in for when it's locked/unlocked and that works fine. Whenever I right-click the key it doesn't show any options though other than the standard make copy. Where could I have gone wrong? The files are all there, in the right places and I've gone over the instructions multiple times, retrying it all. Was I supposed to add some lines in the compiles.sqf and I just didn't see that part? Let me know if you need more information to help, thanks.

Link to comment
Share on other sites

I hate to post a non-descriptive request for help, but I can't seem to get this to work. I've got the car sound added in for when it's locked/unlocked and that works fine. Whenever I right-click the key it doesn't show any options though other than the standard make copy. Where could I have gone wrong? The files are all there, in the right places and I've gone over the instructions multiple times, retrying it all. Was I supposed to add some lines in the compiles.sqf and I just didn't see that part? Let me know if you need more information to help, thanks.

I think its just mouse scroll with lock/unlock car. I dont have also any options in my right click in key.  This is what you need to put Compiles sqf "local_lockUnlock =            compile preprocessFileLineNumbers "custom\local_lockUnlock.sqf";        //When vehicle is local to unit perform locking vehicle"

Link to comment
Share on other sites

Thanks White, I didn't have the gearmenuchecks. Now I can get the menu to come up, but I'm running into another problem. For some reason, when starting the engine of any vehicle, it only shows that it started for the person who used the key, so it's client sided. Also it will randomly shut off, like when I start up a helicopter it starts spinning up on my screen (client sided) and my freind cant see that it starts, then it shuts off after a second or three. Any ideas?

 

UPDATE: It gives an error in our admin panel that the player is not in a playable unit or something along those lines.

Link to comment
Share on other sites

Also, how do I get the lock/unlock sound to play when remote lock/unlocking the car?

 

Re-read step 7 of the original post, in particular the part regarding local_lockUnlock.sqf.

 

Any Chance to put that on a Key or maybe if you are 50 meters away from the vehicle the epoch standart "lock vehicle" and "unlock vehicle" open?

That is what the script does, it gives you a right-click menu for the keys that allows you to lock/unlock vehicles from a distance.

Link to comment
Share on other sites

Hm so you cant help me with that?

 

BTW NICE SCRIPT

Another question. On my Server there is "locked cars = godmode" active. so if player will get into a car and lock it the car is in godmode =D

with normal cars it is no problem but on my server u can buy all arma vehicles include tanks and jets so they would be in godmode too, thats a bit imba.

is there any way to disable the script when players are in the vehicle?

Post your last question on the forum where you got the script from, not here.

Link to comment
Share on other sites

For some reason, when starting the engine of any vehicle, it only shows that it started for the person who used the key, so it's client sided. Also it will randomly shut off, like when I start up a helicopter it starts spinning up on my screen (client sided) and my freind cant see that it starts, then it shuts off after a second or three. Any ideas?

Link to comment
Share on other sites

Hm so you cant help me with that?

 

Well, it's a bit complicated. When you right-click you have already selected a vehicle to look for. When using a self_action menu, you'll have to do it completely different, looking at all vehicles within an area and determine per vehicle if you have a matching key for it.

As I am working on a completely new version based on this and I don't see myself adding the feature to this script I'd have to deffer you to the scripting help section for further assistance if you need more information on how to create self_actions.

BTW NICE SCRIPT

Thank you very much ^^

Another question. On my Server there is "locked cars = godmode" active. so if player will get into a car and lock it the car is in godmode =D

with normal cars it is no problem but on my server u can buy all arma vehicles include tanks and jets so they would be in godmode too, thats a bit imba.

is there any way to disable the script when players are in the vehicle?

Sounds to me like you need to fix the god mode script so that god mode is not enabled while people are inside of the vehicles.

 

For some reason, when starting the engine of any vehicle, it only shows that it started for the person who used the key, so it's client sided. Also it will randomly shut off, like when I start up a helicopter it starts spinning up on my screen (client sided) and my freind cant see that it starts, then it shuts off after a second or three. Any ideas?

Actually, that is a known bug which I haven't solved yet. But now that you mention that it only starts locally makes sense, thank you for your input.

Link to comment
Share on other sites

So is there no chance to disable the right klick menu when you are inside a vehicle?

The following changes should disable the right-click menu if user is inside a vehicle. It's not tested, use with caution.

player_selectSlot.sqf

_vehicle = vehicle player; //<-- new line
_inVehicle = (_vehicle != player); //<-- new line
if (!_inVehicle) then //<-- new line
{ //<-- new line

/*
		Begin: Vehicle remote lock/unlock
	*/
		_itemsPlayer = items player;
		
		_temp_keys = [];
		_temp_keys_names = [];
		// find available keys
		_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
		if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _item)) in _key_colors) then {
			_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _item >> "keyid");
			_ownerKeyName = getText(configFile >> "CfgWeapons" >> _item >> "displayName");
			_temp_keys_names set [_ownerKeyId,_ownerKeyName];
			
			_objects = nearestObjects [getPos player, ["LandVehicle","Helicopter","Plane","Ship"], 50];
			_i = 0;
			{
				if (alive _x) then {
					_ownerID = _x getVariable ["CharacterID", "0"];
					_hasKey = (_ownerID == str(_ownerKeyId));
					_oldOwner = (_ownerID == dayz_playerUID);

					if(_hasKey or _oldOwner) then {
						if(locked _x) then {
							//Unlock
							_menu =  _parent displayCtrl (1600 + _numActions);
							_menu ctrlShow true;
							_text =  "Unlock";
							_script =  "[""" + _ownerID + """] execVM ""scripts\remote_unlock.sqf""";
							_height = _height + (0.025 * safezoneH);
							uiNamespace setVariable ['uiControl', _control];
							_menu ctrlSetText _text;
							_menu ctrlSetEventHandler ["ButtonClick",_script];
						} else {
							//Lock
							_menu =  _parent displayCtrl (1600 + _numActions);
							_menu ctrlShow true;
							_text =  "Lock";
							_script =  "[""" + _ownerID + """] execVM ""scripts\remote_lock.sqf""";
							_height = _height + (0.025 * safezoneH);
							uiNamespace setVariable ['uiControl', _control];
							_menu ctrlSetText _text;
							_menu ctrlSetEventHandler ["ButtonClick",_script];
						};
						//Engine start
						_menu =  _parent displayCtrl (1600 + _numActions + 1);
						_menu ctrlShow true;
						_text =  "Engine";
						_script =  "[""" + _ownerID + """] execVM ""scripts\remote_engine.sqf""";
						_height = _height + (0.025 * safezoneH);
						uiNamespace setVariable ['uiControl', _control];
						_menu ctrlSetText _text;
						_menu ctrlSetEventHandler ["ButtonClick",_script];
					};
					
					_i = _i + 1;
				};
			} forEach _objects;
		};
	/*
		End: Vehicle remote lock/unlock
	*/
}; //<-- new line

Link to comment
Share on other sites

The code is only like car with key + locked = no damage.

My suggestion would be car with key + locked + no people inside mentioned car = no damage ^_^

So they cant use a bug to godmode a car while sitting in it.

The problem likely still exist as someone from the outside of the car can still lock a vehicle with people inside using the "normal" way of locking vehicles. So you can probably still use vehicle god mode, but not it requires two people collaborating.

So i have to say this is one of the best scripts on my server.

If you got any updates for bind it on key or stuff let me know =)

Thanks. I'm working on a completely new version that will also work with base doors. Will post something about it here once it's mature for release.

Link to comment
Share on other sites

The problem likely still exist as someone from the outside of the car can still lock a vehicle with people inside using the "normal" way of locking vehicles. So you can probably still use vehicle god mode, but not it requires two people collaborating.

 

 

For folks using the script in a fix was posted to prevent locked car god-mode abuse.

Link to comment
Share on other sites

So whats about that code in my fn_selfactions. Any chance to increase the distance when this menu opens? And btw my server is at nitrado.de so there is that infistar admin tool. when u press 1 and 2 you can lock and unlock the car which u are looking at.

 

    // Allow Owner to lock and unlock vehicle  

    if(_player_lockUnlock_crtl) then {

        if (s_player_lockUnlock_crtl < 0) then {

            _hasKey = _ownerID in _temp_keys;

            _oldOwner = (_ownerID == dayz_playerUID);

            if(locked _cursorTarget) then {

                if(_hasKey or _oldOwner) then {

                    _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];

                    s_player_lockunlock set [count s_player_lockunlock,_Unlock];

                    s_player_lockUnlock_crtl = 1;

                } else {

                    if(_hasHotwireKit) then {

                        _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];

                    } else {

                        _Unlock = player addAction [format["<t color=#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED], "",_cursorTarget, 2, true, true, "", ""];

                    };

                    s_player_lockunlock set [count s_player_lockunlock,_Unlock];

                    s_player_lockUnlock_crtl = 1;

                };

            } else {

                if(_hasKey or _oldOwner) then {

                    _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];

                    s_player_lockunlock set [count s_player_lockunlock,_lock];

                    s_player_lockUnlock_crtl = 1;

                };

 

A few if statements prior to that code a max range is set as _allowedDistance, which is normally 4 - which is the reason why you need to be close to a vehicle (and other stuff) to get the menu options.

if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then 
You would need to either increase _allowedDistance, which would also affect the range of other stuff like opening vaults, or you need to re-work that code into a new if-block.
Link to comment
Share on other sites

  • 2 weeks later...

How can i add both scripts sounds

class CfgSounds
{
sounds[] =
{
        carLock
};
class carLock
{
        name="carLock";
        sound[]={carlock.ogg,0.9,1};
        titles[] = {};
};
};

and Radio

class CfgSounds
{
sounds[] =
{
  track1,track2
};
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[]={};
    };
};

 

Link to comment
Share on other sites

How can i add both scripts sounds

[...]

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[]={};
    };
};

Link to comment
Share on other sites

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...