Popular Post OtterNas3 Posted January 11, 2014 Popular Post Report Share Posted January 11, 2014 Just finished it and thought someone could like it... You have many, many (many, ...) Vehicles? You have many, many (many, ...) different Keys? Already need to attach a list with Key = Vehicle to your Monitor to keep track of em? Need 30 minutes to start driving because you dont have such a list? Frustrated? ALL OVER! This little script allows you and the Players on your Server to copy Vehicles, that you got the Key for, to another Key that's in your Inventory! Example: Car 1: Red Skoda - Red Key (1234) Car 2: Green Skoda - Green Key (4321) You need a Keymakers Kit! Put both keys in your Inventory, look at the Car 1 and select "Change Vehicle Key" from the action menu. You get a list with all Keys in your Inventory, to select from a menu. In this case the list would just be one: Green Key (4321) Not in the list is the Key for Car 1, so no Red Key (1234) Select the new Key you want to put the car on and: voila! You can throw away the unneeded Red Key (1234) The Old vehicle Key gets added to your Backpack Car 1 & Car 2 are both now on the Green Key (4321) You can allow players to "Claim" Vehicles that are dynamic spawned on the Map and does not yet need a Key. This is a option you can turn On/Off! You can set a price for claiming vehicles also. THIS DOES NOT HOWEVER INCLUDE MISSIONVEHICLES THAT ARE NOT SPAWNED CORRECTLY!IF YOU WANT TO BE ABLE TO CLAIM MISSIONVEHICLES, TELL THE MISSION DEVELOPER TO SETUP HIS SPAWNCODE FOR VEHICLES TO A CORRECT WAY! Changelog 1.4 I changed some functions and implemented some small fixes mentioned by other users in this Thread. Specially for just bought vehicles and the "get not saved after driving" thing. This should also fix the duping for some of you, i never had it yet and cant reproduce. just made the call a bit different now. If it doesnt work as it should, gimme a shout. And for people that think this Mod is a total mess. Dont use it? It works on my Server for a loooooooooooooong time now without any errors! Demo Video http://www.youtube.com/watch?v=bEUmLrje_5o Like? DOWNLOAD:https://www.dropbox.com/s/mq0dvpzawtwmam8/VehicleKeyChanger_v1.4.zip Install Instructions:1. Download and unzip VehicleKeyChanger_v1.4.zip2. unpbo MPMissions\YOURMISSIONNAME.pbo3. copy the custom folder from the unziped VehicleKeyChanger_v1.4.zip to MPMissions\YOURMISSIONNAME\4. open MPMissions\YOURMISSIONNAME\init.sqf Find this block: if (!isDedicated) then { 0 fadeSound 0; waitUntil {!isNil "dayz_loadScreenMsg"}; dayz_loadScreenMsg = (localize "STR_AUTHENTICATING"); _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}]; }; And insert this line above the closing bracket }; _nil = [] execVM "custom\VehicleKeyChanger\VehicleKeyChanger_init.sqf"; 5.Configuration: Edit custom\VehicleKeyChanger\VehicleKeyChanger_init.sqf Edit this block to your likings! ///////////////////////////////////////////////// ///////////////////////////////////////////////// // Edit these settings to fit your needs/likes // ///////////////////////////////////////////////// ///////////////////////////////////////////////// /// Claim Vehicles that does not yet need Key /// ///////// 0 = Not allowed | 1 = Allowed ///////// vkc_claiming = 0; ///////////////////////////////////////////////// //////// Claim Vehicles costs this Item ///////// /// Any Item can be used here, some examples: /// //// ItemTinBar, ItemSilverBar, ItemGoldBar, //// ////// ItemSilverBar10oz, ItemGoldBar10oz, ////// ///// ItemBriefcase20oz, ItemBriefcase100oz ///// //////// set to "0" to disable the costs //////// vkc_claimingPrice = "ItemGoldBar10oz"; ///////////////////////////////////////////////// ////////// Change Key costs this Item /////////// ////////////// see above examples /////////////// //////// set to "0" to disable the costs //////// vkc_Price = "ItemSilverBar"; ///////////////////////////////////////////////// /////// Need KeyKit to use this function //////// ////////// 0 = Not needed | 1 = Needed ////////// vkc_needKeykit = 1; ///////////////////////////////////////////////// ///////////////////////////////////////////////// /////////////// DONT EDIT BELOW ! /////////////// ///////////////////////////////////////////////// 5. repbo MPMissions\YOURMISSIONNAME\ - upload it to your server - 6. unpbo @DayZ_Epoch_Server\addons\dayz_server.pbo 7 copy server_updateObject.sqf from your unziped VehicleKeyChanger_v1.4.zip to @DayZ_Epoch_Server\addons\dayz_server\compile\ and overwrite the existing one. (This just adds a function for this mod nothing else changed) If you already have a custom server_updateObjects.sqf you need to compare my file with yours and make the changes yourself! 8. repbo @DayZ_Epoch_Server\addons\dayz_server\ - upload it to your server - 9 copy this file to your Servers BattlEye filters folder:publicvariableval.txt FYI: INFISTAR AdminCheat, ummm sorry meant AntiCheat, users!Cause he uses his own BE filter files should not copy paste this file over your existing one, else you will get kicked for all the cool nice admin functions that comes with your Infistar! You need to do the change yourself if you get kicked for anything regarding this script.I dont had and will not have a look at Infistar's BE files to sort things out! 10. Restart your server11. Enjoy it and cleanup your vaults! 12. DONT LOOSE YOUR MASTERKEY! :rolleyes: -- Additional Information --- For InfiStar AdminCheat (ummm sorry meant AntiCheat...) users: adding "#USER:_keyMenu" in the ALLOWED CMDMenus list (_cMenu=) as cen said is all you need to make this work properly :) Have fun with it! - If you like it - Like it - So I can count Downloads - I like that ##################################### # Support my work # # & # # Donate # ##################################### FoRcE72, Havoc302, MickyMeowse and 67 others 70 Link to comment Share on other sites More sharing options...
Achmed Posted January 11, 2014 Report Share Posted January 11, 2014 This sounds cool. Any chance of a video showing how it works? Link to comment Share on other sites More sharing options...
calamity Posted January 11, 2014 Report Share Posted January 11, 2014 I cant get this to work. do I need anything more than 2 cars and the keys to get this working ? init.sqf......... call compile preprocessFileLineNumbers "compiles.sqf"; //Compile regular functions my compiles in root compiles............ fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf"; fn_selfActions.sqf............. changed "custom\VehicleKeyChanger.sqf", this is where I put it. //Vehicle Key Changer START if (speed player <= 1 && !isEngineOn _cursorTarget && (_typeOfCursorTarget == "Car" || _typeOfCursorTarget == "Air" || _typeOfCursorTarget == "Ship")) then { if (_ownerID != "0") then { _temp_keysDisplayName = []; { if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then { _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid"); _keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName"); _tempPlayerKeysNames set [count _tempPlayerKeysNames,_keyName]; }; } forEach _itemsPlayer; if (_ownerID in _temp_keys && (count _temp_keys) > 1) then { _carKeyName = (_temp_keys_names select (parseNumber _ownerID)); _tempPlayerKeys = _temp_keys - [_ownerID]; _tempPlayerKeysNames = _tempPlayerKeysNames - [_carKeyName]; if (s_player_copyToKey < 0) then { s_player_copyToKey = player addAction [("<t color="#0000FF"">" + ("Change Vehicle Key") + "</t>"),"custom\VehicleKeyChanger.sqf",[_cursorTarget, _tempPlayerKeys, _ownerID, _tempPlayerKeysNames, _carKeyName],-1,false,false,"","]; }; } else { player removeAction s_player_copyToKey; s_player_copyToKey = -1; }; } else { player removeAction s_player_copyToKey; s_player_copyToKey = -1; }; } else { player removeAction s_player_copyToKey; s_player_copyToKey = -1; }; // Vehicle Key Changer END Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 Sorry i was out for lunch when i found the failure and it seems my mobile did not made the change complete to the post. Looks like you copied before i made the change to the code for the fn_selfActions.sqf change this line: if (speed player <= 1 && !isEngineOn _cursorTarget && (_typeOfCursorTarget == "Car" || _typeOfCursorTarget == "Air" || _typeOfCursorTarget == "Ship")) then { to this: if (speed player <= 1 && !isEngineOn _cursorTarget && (_cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { And you just need the one Car you wanna change to a new Key. You need the Key to change it to and the Key it is actually on. Both have to be in your Inventory (Toolbelt), not in your Backpack. Link to comment Share on other sites More sharing options...
NAIL Posted January 11, 2014 Report Share Posted January 11, 2014 (edited) I just installed this, however I added the key makers kit as a requirement. here are my first 4 lines, the rest is the same. //Vehicle Key changer script if("ItemKeyKit" in _itemsPlayer) then { hasItemKeyKit = true; } if (speed player <= 1 && hasItemKeyKit && !isEngineOn _cursorTarget && (_cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { edit for typo Edited January 11, 2014 by NAIL Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 Good idea with the Keykit, never thought about it :P You could do this with a oneliner also: _hasKeyKit = "ItemKeyKit" in _itemsPlayer; if (speed player <= 1 && _hasKeyKit && !isEngineOn _cursorTarget && (_cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { updated my first post with it, thanks for the idea! Link to comment Share on other sites More sharing options...
RRP47 Posted January 11, 2014 Report Share Posted January 11, 2014 Does this work for just 2 vehicles, or will it work for an entire fleet? :D Link to comment Share on other sites More sharing options...
NAIL Posted January 11, 2014 Report Share Posted January 11, 2014 Good idea with the Keykit, never thought about it :P You could do this with a oneliner also: _hasKeyKit = "ItemKeyKit" in _itemsPlayer; if (speed player <= 1 && _hasKeyKit && !isEngineOn _cursorTarget && (_cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { updated my first post with it, thanks for the idea! Your welcome, and thanks for your code, I have been wanting this for a while myself. I'm just starting coding in Arma so I don't take on large project yet, but I am learning every day and I can usually adapt things to suit my needs. You may want to add the criteria of having the kit to your first post aswell. people will install it and it won't work because they don't have the kit. Then instead of reading down to the 5th post, they will spam this topic with "it doesn't work". Link to comment Share on other sites More sharing options...
NAIL Posted January 11, 2014 Report Share Posted January 11, 2014 10:30:56 Error in expression <sKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { if (_ownerID != "0") > 10:30:56 Error position: <== "Ship")) then { if (_ownerID != "0") > 10:30:56 Error Invalid number in expression 10:30:56 File mpmissions\__cur_mp.panthera2\scripts\fn_selfActions.sqf, line 226 10:30:56 Error in expression <sKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { if (_ownerID != "0") > 10:30:56 Error position: <== "Ship")) then { if (_ownerID != "0") > 10:30:56 Error Invalid number in expression 10:30:56 File mpmissions\__cur_mp.panthera2\scripts\fn_selfActions.sqf, line 226 10:30:57 Error in expression <17578e-005]; (_cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf == "Ship") note the == its only in the last statement. Link to comment Share on other sites More sharing options...
Black Stormy Posted January 11, 2014 Report Share Posted January 11, 2014 anyone got this working? been looking for a keyring script for a long time but im hesistant to install anything that requires me to debug the code myself. Link to comment Share on other sites More sharing options...
NAIL Posted January 11, 2014 Report Share Posted January 11, 2014 its working up till selecting the key for me. take out the == in the line i mention above your post to get where I am. after select Change Vehicle Key I get Change Vehicle to Key: = Exit no option to select the key. Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 Your welcome, and thanks for your code, I have been wanting this for a while myself. I'm just starting coding in Arma so I don't take on large project yet, but I am learning every day and I can usually adapt things to suit my needs. You may want to add the criteria of having the kit to your first post aswell. people will install it and it won't work because they don't have the kit. Then instead of reading down to the 5th post, they will spam this topic with "it doesn't work". Already put it in my first post :) 10:30:56 Error in expression <sKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { if (_ownerID != "0") > 10:30:56 Error position: <== "Ship")) then { if (_ownerID != "0") > 10:30:56 Error Invalid number in expression 10:30:56 File mpmissions\__cur_mp.panthera2\scripts\fn_selfActions.sqf, line 226 10:30:56 Error in expression <sKindOf "Air" || _cursorTarget isKindOf == "Ship")) then { if (_ownerID != "0") > 10:30:56 Error position: <== "Ship")) then { if (_ownerID != "0") > 10:30:56 Error Invalid number in expression 10:30:56 File mpmissions\__cur_mp.panthera2\scripts\fn_selfActions.sqf, line 226 10:30:57 Error in expression <17578e-005]; (_cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf == "Ship") note the == its only in the last statement. Yeah i really hate those typos, changed it, thanks for the hint! its working up till selecting the key for me. take out the == in the line i mention above your post to get where I am. after select Change Vehicle Key I get Change Vehicle to Key: = Exit no option to select the key. Did you had 2 Keys in your inventory? The key for the vehicle you wanna change and a Key to move it to? I think i should post it with my script for checking if addAction is needed, i doesnt like this fn_selfActions.sqf for it anyway. i just had to convert it from my caller to the fn_selfActions.sqf thought would be better, bad idea... Gimme 10 minutes and i update my first Post with a package with my caller in it, which definately works... Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 Updated first post Sorry for the trouble, im not a Pro(grammer) :unsure: Link to comment Share on other sites More sharing options...
calamity Posted January 11, 2014 Report Share Posted January 11, 2014 left the fn_selfActions.sqf out in the instructions ?? Link to comment Share on other sites More sharing options...
cen Posted January 11, 2014 Report Share Posted January 11, 2014 Why are you calling this file from init.sqf _nil = [] execVM "custom\vehiclefunctions.sqf"; When the zip includes VehicleKeyChanger\VehicleKeyChanger.sqf Link to comment Share on other sites More sharing options...
calamity Posted January 11, 2014 Report Share Posted January 11, 2014 :huh: verry confused do I still keep the fn_selfactions that used to be in the instructions or start fresh and only add to init.sqf ? Link to comment Share on other sites More sharing options...
NAIL Posted January 11, 2014 Report Share Posted January 11, 2014 Did you had 2 Keys in your inventory? The key for the vehicle you wanna change and a Key to move it to? I think i should post it with my script for checking if addAction is needed, i doesnt like this fn_selfActions.sqf for it anyway. i just had to convert it from my caller to the fn_selfActions.sqf thought would be better, bad idea... Gimme 10 minutes and i update my first Post with a package with my caller in it, which definately works... Yes, I went to my +debug island+ spawned in 2 muzzies and had only their keys in my gear. Got no option without the keymakers kit. Added keymakers kit and got the option. but no key menu. It may have to do with the infistar AH. one of my clanmates was kicked for attempting it, have to whitelist the add menu action. I will check it again when i restart server next. I do rather like having it in fn_selfActions.sqf better, gives me personally more control, and I am pretty sure the problem I have has nothing to do with that, its either the AH or the VehicleKeyChanger.sqf file (probably the AH) Link to comment Share on other sites More sharing options...
fullaholes Posted January 11, 2014 Report Share Posted January 11, 2014 Shouldn't this _nil = [] execVM "custom\vehiclefunctions.sqf"; be this instead _nil = [] execVM "custom\VehicleKeyChanger.sqf"; ? :huh: Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 left the fn_selfActions.sqf out in the instructions ?? No need for the fn_selfActions.sqf anymore its called in the init.sqf Why are you calling this file from init.sqf _nil = [] execVM "custom\vehiclefunctions.sqf"; When the zip includes VehicleKeyChanger\VehicleKeyChanger.sqf This is the init line for it, it starts a checker, which checks every 3 seconds for a valid Target, instead all 0.2 seconds like fn_selfActions.sqf does No need to check it that often, in my opinion So just insert this line in your init.sqf on the mentioned position and youre good to go You can remove the code from your custom fn_selfActions.sqf If you did not mady any other change to the fn_selfActions.sqf or compiles.sqf, for another mod, you can change the compiles.sqf call in your init.sqf back to standard call compile preprocessFileLineNumbers "dayz_code\init\compiles.sqf"; to call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf"; :huh: verry confused do I still keep the fn_selfactions that used to be in the instructions or start fresh and only add to init.sqf ? Start fresh and just add this line to your init.sqf Yes, I went to my +debug island+ spawned in 2 muzzies and had only their keys in my gear. Got no option without the keymakers kit. Added keymakers kit and got the option. but no key menu. It may have to do with the infistar AH. one of my clanmates was kicked for attempting it, have to whitelist the add menu action. I will check it again when i restart server next. I do rather like having it in fn_selfActions.sqf better, gives me personally more control, and I am pretty sure the problem I have has nothing to do with that, its either the AH or the VehicleKeyChanger.sqf file (probably the AH) I hope this +debug island+ is not really in the debug zone ^^ i had problems with saving Vehicles there and get variables from vehicles But cuase your clanmate got kicked im sure it has something todo with whitelist the action. Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 Shouldn't this _nil = [] execVM "custom\vehiclefunctions.sqf"; be this instead _nil = [] execVM "custom\VehicleKeyChanger.sqf"; ? :huh: Nope, the custom\vehiclefunctions.sqf is the looper for checking for valid vehicles and if it founds one with all conditions meet it gives you the action menu entry WHICH calls the custom\VehicleKeyChanger\VehicleKeyChanger.sqf Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 If anyone still has problems with installing or get it running, i could talk to em in teamspeak to help! frino.de:9992 Just poke me there Link to comment Share on other sites More sharing options...
Guest Posted January 11, 2014 Report Share Posted January 11, 2014 The confusion is being caused because custom\vehiclefunctions.sqf is not in the download. Link to comment Share on other sites More sharing options...
fullaholes Posted January 11, 2014 Report Share Posted January 11, 2014 Nope, the custom\vehiclefunctions.sqf is the looper for checking for valid vehicles and if it founds one with all conditions meet it gives you the action menu entry WHICH calls the custom\VehicleKeyChanger\VehicleKeyChanger.sqf But I don't have a file in my custom folder called vehiclefunctions.sqf so how can it call it or is the vehiclefunctions.sqf file not needed in the custom folder ? Surely it's needed if it's being called in the init.sqf ? Link to comment Share on other sites More sharing options...
OtterNas3 Posted January 11, 2014 Author Report Share Posted January 11, 2014 Did you redownloaded it? just downloaded it and it is inside of it for me? Link to comment Share on other sites More sharing options...
RRP47 Posted January 11, 2014 Report Share Posted January 11, 2014 this work for only 2 vehicles or can a whole fleet can be changed to the masterkey? 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