david Posted May 9, 2014 Author Report Share Posted May 9, 2014 Excuse me, but in which file(s) and where exactly do I put this? I'm assuming it goes directly above the last }; but wanted to be sure. I can follow directions and have managed to Frankenstein a few scripts together but I'm still very much learning. I'm split between putting it at the end of player_selectSlot or remote_lock and remote_unlock. I'd put it as soon as I know that the lock/unlock action will be performed, probably right afterif(_hasKey or _oldOwner) then {.. in player_selectSlot.sqfEdit: This might be a terrible idea to do.. To the OP: Thank you so much for posting this!!! I have taken all of the customizations and bundled them together for our server. I can't wait to see what our players think of this! Keep up the awesome work! Also, please do not give up on the remote Garage Door idea. I know many, many people would absolutely love that! I'm thinking of tying this to a radio instead of an IR strobe simply because it makes a little more sense in my mind. If they want radios they can go hunt down some AIs in the missions. Tying the garages to the radios as well would be an added bonus for me.Thanks, I'm glad to hear that and I hope your players will enjoy it.I will be looking into it, can't make any promises though. Link to comment Share on other sites More sharing options...
Diesel Weasel Posted May 9, 2014 Report Share Posted May 9, 2014 I'd put it as soon as I know that the lock/unlock action will be performed, probably right after if(_hasKey or _oldOwner) then { .. in player_selectSlot.sqf Thanks, I'm glad to hear that and I hope your players will enjoy it. I will be looking into it, can't make any promises though. And wrong again xD At least my hunch on which file was correct! Many thanks! =] Link to comment Share on other sites More sharing options...
david Posted May 9, 2014 Author Report Share Posted May 9, 2014 Thanks I will give it a shotDid you manage to get this to work? It might help others if you share your experience on the problem and solution. Link to comment Share on other sites More sharing options...
Longshot03XX Posted May 9, 2014 Report Share Posted May 9, 2014 well server didnt crash... but no sound played Link to comment Share on other sites More sharing options...
raymix Posted May 9, 2014 Report Share Posted May 9, 2014 (edited) David, i've been working on fixing the issue where players would lock themselves in a car (you'd be surprised how often it'd be even same person), so I decided to go hotkey route instead of action menu, just to keep it clean. Basically, the idea is also to let owners lock themselves in a car to prevent "unauthorized" access to vehicle/aircraft while they are trying to take off. Problem is, its morning here and I am super tired, finished my own scripts and decided to look into yours before I apply it to my own server... my brain seriously stops at this point, see if you can figure this out. EDIT: code removed Edited May 10, 2014 by raymix Link to comment Share on other sites More sharing options...
Longshot03XX Posted May 9, 2014 Report Share Posted May 9, 2014 .......and no lights came on Link to comment Share on other sites More sharing options...
RimBlock Posted May 9, 2014 Report Share Posted May 9, 2014 Nice idea. Thoughts, ideas and suggestions. vehicle + Key + fob + receiver = remote key vehicle + strobe light + remote key = light flash alarm vehicle + strobe light + remote key + speaker = Alarm with light flash & sound Lockable door + strobe light + vehicle or generator = light flash alarm Lockable door + strobe light + vehicle or generator + speaker = Alarm with light flash & sound Vehicle / generator (must be on) for power of alarm system. Alarms can be set-off by the item receiving damage or multiple failed unlock attempts (doors). Alarms agro zombies :D . Some interesting possibilities of attacking cars or bases to deliberately agro zombies or draw player attention. Potential issues: Items to use as key fob and speaker (possibly radio). Recoding multiple keys to a single key would need a bit more thought. I would also be tempted to expand the custom\local_lockUnlock.sqf to allow at least one more parameter to enable a sound (true/false). Might also be worth taking a look at the lock/unlock sqfs so they can be put in to a single lockunlock sqf for cars, doors, vaults etc. That would be best coming from the project team most probably though. RB Link to comment Share on other sites More sharing options...
david Posted May 9, 2014 Author Report Share Posted May 9, 2014 David, i've been working on fixing the issue where players would lock themselves in a car (you'd be surprised how often it'd be even same person), so I decided to go hotkey route instead of action menu, just to keep it clean. Basically, the idea is also to let owners lock themselves in a car to prevent "unauthorized" access to vehicle/aircraft while they are trying to take off.Problem is, its morning here and I am super tired, finished my own scripts and decided to look into yours before I apply it to my own server... my brain seriously stops at this point, see if you can figure this out.Im at work now and can't experiment at the moment, will have a look at it tonight if you haven't managed to solve it before then. .......and no lights came onSounds like local_lockUnlock is not correctly overridden. Have you followed step 6 with changing the compiles.sqf file?[]local_lockUnlock = compile preprocessFileLineNumbers "custom\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle@RimBlockThanks for the feedback, looks like the alarm thingy could be something to expand upon. Link to comment Share on other sites More sharing options...
RimBlock Posted May 9, 2014 Report Share Posted May 9, 2014 @RimBlock Thanks for the feedback, looks like the alarm thingy could be something to expand upon. Could change the dynamics of the game quite a lot. I can see it being used tactically to great advantage. Security by obscurity doesn't work quite so well if your base is blasting out an alarm :D . The automatic garage door opener would also be good as it is a PITA to get out of the car and open the door and then get in, drive through, close the door and if you have two (airlock style for security) then doubly so. Hotkeying the car unlock may also be better as digging around in your backpack whist being chased by a zombie conga line with shots flying over your head in order to open your escape vehicle may not be as useful as it could be ;) . Link to comment Share on other sites More sharing options...
Longshot03XX Posted May 9, 2014 Report Share Posted May 9, 2014 yup i forgot the local_lockUnlock for compiles. I'll give it another go. I really appreciate the feedback man, Link to comment Share on other sites More sharing options...
Longshot03XX Posted May 9, 2014 Report Share Posted May 9, 2014 everything works. Thanks!!! Link to comment Share on other sites More sharing options...
david Posted May 9, 2014 Author Report Share Posted May 9, 2014 everything works. Thanks!!!Cheers. Link to comment Share on other sites More sharing options...
hozzdutch Posted May 9, 2014 Report Share Posted May 9, 2014 The beep sound is played from local_lockUnlock.sqf, which handles nearly all propper locking/unlocking calls. To make it play only when clicked from the menu, you need to add it to the player_selectSlot.sqf instead which handles the menu stuff. Remove this line from custom\local_lockUnlock.sqf (both occurrences): _nul = [objNull, _vehicle, rSAY, "carLock", _sounddist] call RE; And add this line in player_selectSlot.sqf: _nul = [objNull, _x, rSAY, "carLock", _sounddist] call RE; ... directly below this line: if(_hasKey or _oldOwner) then { Thanks for that. I tried this but it doesn't quite work as I expected... Just the act of right clicking on the key causes the sound to play whereas the sound should play on the left click of lock/unlock. I tried moving the line of code around in various parts of the chunk of code added to the player_selectSlot.sqf (i thought, in a logical way, that moving towards the end might make the sound play after left click), but that didn't work. Maybe I'm asking too much, but is it possible to have the sound play when actually clicking Lock/Unlock...if not, how about this... When you click it checks your distance from the car. If you are 3m or more from the car, it plays the sound...as less than this you would be using the key in the lock? Link to comment Share on other sites More sharing options...
david Posted May 9, 2014 Author Report Share Posted May 9, 2014 Thanks for that. I tried this but it doesn't quite work as I expected...Just the act of right clicking on the key causes the sound to play whereas the sound should play on the left click of lock/unlock.I tried moving the line of code around in various parts of the chunk of code added to the player_selectSlot.sqf (i thought, in a logical way, that moving towards the end might make the sound play after left click), but that didn't work.Maybe I'm asking too much, but is it possible to have the sound play when actually clicking Lock/Unlock...if not, how about this...When you click it checks your distance from the car. If you are 3m or more from the car, it plays the sound...as less than this you would be using the key in the lock?Oh, sorry about that - mistake from my part. Forget what I wrote earlier :)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_lockUnlockReplace 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]; The earlier code I gave you would trigger when the menu was created. This should trigger when the car is actually locked/unlocked through clicking on the menu.Sorry about the mixup. Link to comment Share on other sites More sharing options...
insomniaK Posted May 9, 2014 Report Share Posted May 9, 2014 work great thx but no light...it work only at night ? Link to comment Share on other sites More sharing options...
Diesel Weasel Posted May 9, 2014 Report Share Posted May 9, 2014 Just so you know... I set this up on my server with the following edits: Required Radio to work Close inventory on use Latest sound update so it plays only when a player uses the remote We just spent a good 2 hours trying to figure out what was going wrong with our server. Somehow one of the above "edits" (I suspect the close inventory one) disabled right click on the entire server, bandages and food included. All right clicking that was default to epoch was gone. I had a hell of a time trying to find the source of the issue. In the end I gave up and out of frustration just reverted the entire script back to default as listed in the first post. My next step was deletion. Turned the server back on and suddenly right click works as well as the remote key. I have no idea what it was exactly of the three things listed... I'm just happy it's working now. @____@ And I redid the script 3 times before that following the instructions given. My paths were all correct, it was the files themselves I reverted to get it working. david 1 Link to comment Share on other sites More sharing options...
david Posted May 9, 2014 Author Report Share Posted May 9, 2014 Just so you know...I set this up on my server with the following edits:Required Radio to workClose inventory on useLatest sound update so it plays only when a player uses the remote We just spent a good 2 hours trying to figure out what was going wrong with our server. Somehow one of the above "edits" (I suspect the close inventory one) disabled right click on the entire server, bandages and food included. All right clicking that was default to epoch was gone. I had a hell of a time trying to find the source of the issue. In the end I gave up and out of frustration just reverted the entire script back to default as listed in the first post. My next step was deletion. Turned the server back on and suddenly right click works as well as the remote key. I have no idea what it was exactly of the three things listed... I'm just happy it's working now. @____@ And I redid the script 3 times before that following the instructions given. My paths were all correct, it was the files themselves I reverted to get it working.Oh dear, I'm sorry to hear that.I think you are right that it's the closeDialog that caused it also. Suggesting to put the closeDialog call in player_selectSlot.sqf was probably not to bright, since it's run before the actual menu click takes place.It should probably be placed in remote_lock.sqf and remote_unlock.sqf, as they are executed once the click has taken place. I'm not able to test it at the moment though so I cant say for sure.Sorry for the trouble caused :) Link to comment Share on other sites More sharing options...
raymix Posted May 10, 2014 Report Share Posted May 10, 2014 (edited) ok, here's a temporary fix that uses [right Shift] to lock/unlock vehicles, if people lock themselves in (due to inaccessible gear while inside locked car) Downsides: *It does not check if owner *It does not check if car has a key *It is spammable I'll stop here for now, since I've got bigger fish to fry now. But if anybody still interested, here's the code: init.sqf Inside of if (!isDedicated) then { somewhere at bottom after //Lights [] ExecVM "custom\remote\shiftlock.sqf"; shiftlock.sqf private ["_key"]; if (!isnil "keyp") then { (findDisplay 46) displayRemoveEventHandler ["KeyDown", keyp]; //Important! Releases handle so other displays (like AH) works. }; keyPressed = { _key = _this select 1; //Right Shift pressed if (_key == 54) then { if (vehicle player == player) then { //check if player inside vehicle systemchat format ["You are not in a vehicle!"]; } else { sleep 5; if(!locked vehicle player) then { s_player_lockUnlock_crtl = 1; PVDZE_veh_Lock = [vehicle player,true]; if (local vehicle player) then { PVDZE_veh_Lock spawn local_lockUnlock } else { publicVariable "PVDZE_veh_Lock"; }; titleText ["Vehicle has been locked","PLAIN DOWN"]; } else { s_player_lockUnlock_crtl = 1; PVDZE_veh_Lock = [vehicle player,false]; if (local vehicle player) then { PVDZE_veh_Lock spawn local_lockUnlock } else { publicVariable "PVDZE_veh_Lock"; }; titleText ["Vehicle has been unlocked","PLAIN DOWN"]; }; }; }; }; //This adds an eventhandler that executes keyPressed when you press a key on your keyboard waituntil {!(IsNull (findDisplay 46))}; keyp = (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call keyPressed;"]; EDIT: doesn't cooperate with infistar, works for admins only. Not sure how to whitelist a function Edited May 10, 2014 by raymix maxpayne25 and david 2 Link to comment Share on other sites More sharing options...
david Posted May 16, 2014 Author Report Share Posted May 16, 2014 Release v0.2Have updated the code and added a feature for remote vehicle engine start (thanks for the suggestion J.Dohja). Also added a check so that the player can't activate the menu from within a vehicle and lock themselves in (thanks for the feedback shaundibble69 & raymix).Edit: Please note that there is a known issue with engine start. For some reason, if the player has not been in the vehicle the engine will start but quickly shut down again. If the player has entered the vehicle, it works and the engine is kept on. Also, I'm unable to shut down the engine - unsure why. Still, the code should be stable as/is. raymix 1 Link to comment Share on other sites More sharing options...
cen Posted May 16, 2014 Report Share Posted May 16, 2014 Why remove the ability to lock while inside a vehicle? I think that's one of the great features of A3 vehicles where you can lock/unlock a vehicle while being inside it. Link to comment Share on other sites More sharing options...
Bambit Posted May 16, 2014 Report Share Posted May 16, 2014 But you couldn't unlock it, because lock/unlock is a right click option from the inventory, and as you now, you can't access inventory in a locked vehicle ;D As a result you would end up being trapped in your own car Link to comment Share on other sites More sharing options...
macdog Posted May 16, 2014 Report Share Posted May 16, 2014 Why remove the ability to lock while inside a vehicle? I think that's one of the great features of A3 vehicles where you can lock/unlock a vehicle while being inside it. agree with cen. considering implementing this and setting max distance to 0 (or whatever the min is) to only be able to lock when inside purely to counter safezone trolling (people jumping into your car when you drive in). Link to comment Share on other sites More sharing options...
david Posted May 16, 2014 Author Report Share Posted May 16, 2014 I do agree that vehicles should be lockable/unlockable from within the cars or at least allow people to eject from locked vehicles.But I believe that's something best left for a fn_selfactions implementation (scroll based, Bambits explanation covers it) and seems a bit out of scope for what this script is intended for.Edit: ... Unless anyone can devise a good approach to safely allow people to access the inventory while in a locked vehicle? Link to comment Share on other sites More sharing options...
raymix Posted May 16, 2014 Report Share Posted May 16, 2014 afaik, you don't even need fn_selfActions file, you should be able to integrate inside of your own file, just make sure its under !isDedicated so only players are affected as well as state is checked often. if vehicle player == player { if _vehlocked { player addAction [ ("<t color=""#ffffff"">" + ("Unlock") + "</t>"), "unlock.sqf" ]; } else { player addAction [ ("<t color=""#ffffff"">" + ("Lock") + "</t>"), "lock.sqf" ]; }; }; At first I was thinking of adding this to ui_playerslot file, but then it hit me - that particular file is initiated only when gear menu is opened, so it wouldn't work... hence binding right shift instead. But because right shift fix used external file anway, addaction might be more appropriate way to deal with it if using antihack, I guess. david 1 Link to comment Share on other sites More sharing options...
cen Posted May 16, 2014 Report Share Posted May 16, 2014 what about tying it to a key bind like in A3? They use L for lock/unlock. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now