Tricks Posted August 19, 2014 Report Share Posted August 19, 2014 My players goes through the animations but right a the end the key doesn't create and it just said copy failed. I really need that server_updateobject.sqf, anyone have it? Link to comment Share on other sites More sharing options...
Joshi120 Posted August 19, 2014 Report Share Posted August 19, 2014 uhm it is in the zip you downloaded ^^ Link to comment Share on other sites More sharing options...
Tricks Posted August 20, 2014 Report Share Posted August 20, 2014 Hmm I'm a dummy sorry, I just pulled the custom folder out of the zip and then deleted it. Thank you. Link to comment Share on other sites More sharing options...
NetShark Posted August 26, 2014 Report Share Posted August 26, 2014 Hi, Im using this and it's been working ok with some exceptions: 1. When a I change a vehicle key to another one, the vehicle loses the ability of tow / lift / load until next restart. This is not a big deal. We can get used to these. Is this normal? 2. There are some vehicles that cannot use this script, or at least the option "Change Key" or "Claim" dont show up with them. For example: T90 and M1A2 Tusk. Is there a vehicle list that I can modify to include these? Thanks a lot for your script bro, it's really cool. :) NetShark Link to comment Share on other sites More sharing options...
Joshi120 Posted August 26, 2014 Report Share Posted August 26, 2014 hehe you want to change tank keys :D in your VehicleKeyChanger_init.sqf search for this line around 65 if ((_cursorTarget isKindOf "Motorcycle" you can replace it with mine if ((_cursorTarget isKindOf "Motorcycle" || _cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Tank" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf "Ship")) then { NetShark 1 Link to comment Share on other sites More sharing options...
NetShark Posted August 27, 2014 Report Share Posted August 27, 2014 hehe you want to change tank keys :D in your VehicleKeyChanger_init.sqf search for this line around 65 if ((_cursorTarget isKindOf "Motorcycle" you can replace it with mine if ((_cursorTarget isKindOf "Motorcycle" || _cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Tank" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf "Ship")) then { Hey, works like a charm :) Thanks you very much bro. Link to comment Share on other sites More sharing options...
NetShark Posted August 27, 2014 Report Share Posted August 27, 2014 Another weird issue is... whenever I sell one of my vehicles linked to my master key, the master key is sold or disappear from my inventory as well.... If I want to keep it I always have to move it to my backpack not to lose it... did someone have this problem? EDIT Any vehicle I sell deletes its key from my inventory... did this happend normally with latest epoch 1.0.5.1?.. I can't just remember Link to comment Share on other sites More sharing options...
JayOnSpeed Posted August 27, 2014 Report Share Posted August 27, 2014 Another weird issue is... whenever I sell one of my vehicles linked to my master key, the master key is sold or disappear from my inventory as well.... If I want to keep it I always have to move it to my backpack not to lose it... did someone have this problem? EDIT Any vehicle I sell deletes its key from my inventory... did this happend normally with latest epoch 1.0.5.1?.. I can't just remember Yeah its this new version of epoch, the trader gets the key of the vehicle you are selling , i fix it by placing the key in my backpack when selling :) NetShark 1 Link to comment Share on other sites More sharing options...
NetShark Posted August 28, 2014 Report Share Posted August 28, 2014 Yeah its this new version of epoch, the trader gets the key of the vehicle you are selling , i fix it by placing the key in my backpack when selling :) Umm. yeah.. I wasn't sure if it was normal.... didn't notice it until the trader stole my master key :D :D ... Thanks for the answer. Link to comment Share on other sites More sharing options...
SpearMintTrooper Posted August 30, 2014 Report Share Posted August 30, 2014 (edited) Hi all, Been struggling with this one on my OverPoch server, Have re installed it a few time's now and same thing every time. i have the item's (both keys, Key makers kit, 20oz gold (left it on default settings for the mo)). Option comes up nicely in game at bottom of scroll menu, i select the option and then the key i want to change to. It then moves the unwanted key to BP and takes the gold. Next msg is Change Key Failed, (contact admin blabla.....) Refunds gold, Thats it, i have rooted through all the associated SQL's cant find anything outa place. Also bit odd i never see anything in the .RPT for it doing anything. Am i missing something simple or just being a duh......... Thanks for any advice Spear Just had a random thought, i am running OverPoch, will this need to go in the OverPoch mission or the Epoch mission? Edited August 30, 2014 by SpearMintTrooper Link to comment Share on other sites More sharing options...
hellraver Posted August 31, 2014 Report Share Posted August 31, 2014 @SpearMintTrooper This would only happen if the script wants to double the vehicle. Can double or multiply one where you close the menu with the right mouse button. Then the script is not stopped and is waiting for a command. if one then a second time to open the menu, the script executed twice. Link to comment Share on other sites More sharing options...
SpearMintTrooper Posted August 31, 2014 Report Share Posted August 31, 2014 @SpearMintTrooper This would only happen if the script wants to double the vehicle. Can double or multiply one where you close the menu with the right mouse button. Then the script is not stopped and is waiting for a command. if one then a second time to open the menu, the script executed twice. Sry hellraver that made me go cross eyed reading that, not getting what your saying. Thanks Spear Link to comment Share on other sites More sharing options...
hellraver Posted August 31, 2014 Report Share Posted August 31, 2014 @SpearMintTrooperSorry, my english is not perfect :-( I speak German but i could solve the problem with the duping.I managed to solve the problem so, what otter nase loudly does not go as we were talking in teamspeak.@allPlease use this Code in the VehicleKeyChanger.sqf : /***********************************/ /* Vehicle Key Changer v1.4 */ /* Written by OtterNas3 */ /* January, 11, 2014 */ /* Last update: 06/15/2014 */ /***********************************/ /* Setup the private variables */ private ["_locationPlayer","_magazinesPlayer","_max","_j","_actionArray","_targetVehicle","_targetVehicleID","_targetVehicleUID","_playerKeys","_playerKeysDisplayName","_targetVehicleKeyName","_itemKeyName","_targetVehicleClassname","_targetVehiclePos","_targetVehicleDir","_Price","_claimingPrice","_timeout"]; /* Remove the Action Menu entry */ player removeAction s_player_copyToKey; s_player_copyToKey = 0; player removeAction s_player_claimVehicle; s_player_claimVehicle = 0; /* Get the array and setup the variables */ _actionArray = _this select 3; _targetVehicle = _actionArray select 0; _targetVehicleID = _targetVehicle getVariable ["ObjectID","0"]; _targetVehicleUID = _targetVehicle getVariable ["ObjectUID","0"]; /* Check if the Vehicle is in the Database, if false exit */ if (_targetVehicleID == "0" && _targetVehicleUID == "0") exitWith {cutText ["Sorry but\nthis Vehicle does not support\nKeychange/Claiming!","PLAIN",0];s_player_copyToKey = -1;s_player_claimVehicle = -1;}; /* Setup more variables */ _playerKeys = _actionArray select 1; _playerKeysDisplayName = _actionArray select 3; _targetVehicleKeyName = _actionArray select 4; _itemKeyName = _actionArray select 5; _Price = _actionArray select 6; _claimingPrice = _actionArray select 7; _targetVehicleClassname = typeOf _targetVehicle; _targetVehiclePos = getPosATL _targetVehicle; _targetVehicleDir = getDir _targetVehicle; /* Just in case it is a just bought vehicle and does not yet have a ObjectUID variable set */ if (_targetVehicleUID == "0") then { _targetVehicleUID = ""; { _x = _x * 10; if ( _x < 0 ) then { _x = _x * -10 }; _targetVehicleUID = _targetVehicleUID + str(round(_x)); } forEach _targetVehiclePos; _targetVehicleUID = _targetVehicleUID + str(round(_targetVehicleDir + time)); _targetVehicle setVariable["ObjectUID",_targetVehicleUID,true]; }; /* Setup the Key Names list to select from */ keyNameList = []; for "_i" from 0 to (count _playerKeysDisplayName) -1 do { keyNameList set [(count keyNameList), _playerKeysDisplayName select _i]; }; /* Setup the Key Numbers list to select from */ keyNumberList = []; for "_i" from 0 to (count _playerKeys) -1 do { keyNumberList set [(count keyNumberList), _playerKeys select _i]; }; /* Resetting menu variables*/ keyNameSelect = ""; exitscript = true; snext = false; /* Creating the menu */ copyMenu = { private ["_keyMenu","_keyArray"]; _keyMenu = [["",true], ["Select the new Key:", [-1], "", -5, [["expression", ""]], "1", "0"]]; for "_i" from (_this select 0) to (_this select 1) do { _keyArray = [format['%1', keyNameList select (_i)], [_i - (_this select 0) + 2], "", -5, [["expression", format ["keyNameSelect = keyNameList select %1; keyNumberSelect = keyNumberList select %1", _i]]], "1", "1"]; _keyMenu set [_i + 2, _keyArray]; }; _keyMenu set [(_this select 1) + 2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; if (count keyNameList > (_this select 1)) then { _keyMenu set [(_this select 1) + 3, ["Next", [12], "", -5, [["expression", "snext = true;"]], "1", "1"]]; } else { _keyMenu set [(_this select 1) + 3, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; }; _keyMenu set [(_this select 1) + 4, ["Exit", [13], "", -5, [["expression", "keyNameSelect = 'exitscript';"]], "1", "1"]]; showCommandingMenu "#USER:_keyMenu"; }; /* Wait for the player to select a Key from the list */ _j = 0; _max = 10; _locationPlayer = player modeltoworld [0,0,0]; if (_max > 9) then {_max = 10;}; while {keyNameSelect == ""} do { [_j, (_j + _max) min (count keyNameList)] call copyMenu; _j = _j + _max; waitUntil {keyNameSelect != "" || snext || player distance _locationPlayer > 0.2}; snext = false; }; /* Player selected a Key, lets make the Vehicle update call */ if (keyNameSelect != "exitscript") then { /* Check again for the needed price or claiming price and remove em from the players inventory */ _magazinesPlayer = magazines player; if (_Price != "0") then { /* Player still has the costs in hi inventory */ if (_Price in _magazinesPlayer) then { [player, _Price, 1] call BIS_fnc_invRemove; systemChat (format["Keychange costs a %1, thanks for your Payment!", _Price]); /* Player doesn't have the costs anymore, tried to trick the system? */ } else { systemChat (format["Keychange costs a %1, you had it and tried to trick the system - Keychange for this Vehicle disabled!", _Price]); /* This disables the Keychange ability for this vehicle JUST for this Player */ /* However he can relog and try again but it is a little punishment for trying to trick it */ _targetVehicle setVariable ["VKC_disabled", 1]; s_player_copyToKey = -1; s_player_claimVehicle = -1; breakOut "exit"; }; }; if (_claimingPrice != "0") then { /* Player still has the costs in hi inventory */ if (_claimingPrice in _magazinesPlayer) then { [player, _claimingPrice, 1] call BIS_fnc_invRemove; systemChat (format["Claiming Vehicle costs a %1, thanks for your Payment!", _claimingPrice]); /* Player doesn't have the costs anymore, tried to trick the system? */ } else { systemChat (format["Claiming Vehicle costs a %1, you had it and tried to trick the system - Claiming for this Vehicle disabled!", Price]); /* This disables the Claiming ability for this vehicle JUST for this Player */ /* However he can relog and try again but it is a little punishment for trying to trick it */ _targetVehicle setVariable ["VKC_claiming_disabled", 1]; s_player_copyToKey = -1; s_player_claimVehicle = -1; breakOut "exit"; }; }; /* We got the Money lets do our Job */ /* Lock the vehicle */ _targetVehicle setVehicleLock "LOCKED"; /* The super duper OneForAllAnimation... */ player playActionNow "Medic"; /* Remove the Key from the Toolbelt of the player and put it in the Backpack - No Backpack and the Key gets lost */ if (_itemKeyName != "0") then { if (!isNull (unitBackpack player)) then { [player, _itemKeyName, 1] call BIS_fnc_invRemove; (unitBackpack (vehicle player)) addWeaponCargoGlobal [_itemKeyName, 1]; systemChat (format["%1 has been moved to your Backpack", _targetVehicleKeyName]); }; }; /* This calls the custom update function which we put it in server_updateObject.sqf */ PVDZE_veh_Update = [_targetVehicle, "vehiclekey", player, _targetVehicleClassname, keyNumberSelect, keyNameSelect, _targetVehicleID, _targetVehicleUID]; publicVariableServer "PVDZE_veh_Update"; /* Wait for success or timeout */ _timeout = 20; while {_timeout > 0 && isNil "PVDZE_vkc_Success"} do { if (_Price != "0") then { cutText["~~ Performing Keychange ~~\n~~ Please wait ~~","PLAIN",0.5]; }; if (_claimingPrice != "0") then { cutText["~~ Performing Claim ~~\n~~ Please wait ~~","PLAIN",0.5]; }; sleep 1; _timeout = _timeout - 1; }; /* Inform the player about the success and tell him to check the Key */ if (!isNil "PVDZE_vkc_Success") then { if (_Price != "0") then { cutText["~~ Vehicle Keychange - SUCCESS ~~","PLAIN",1]; systemChat (format["Changed Vehicle Key to %1", keyNameSelect]); systemChat (format["Please check Vehicle function with %1 before you throw away %2!", keyNameSelect, _targetVehicleKeyName]); }; if (_claimingPrice != "0") then { cutText["~~ Vehicle Claiming - SUCCESS ~~","PLAIN",1]; systemChat (format["You claimed this Vehicle with: %1", keyNameSelect]); }; PVDZE_vkc_Success = nil; /* This updates the Vehicle as it is now, position, gear, damage, fuel */ /* Should prevent the "backporting" some dudes reported. */ /* Just fyi i never had that but just in case... */ [nil,nil,nil,_targetVehicle] execVM "\z\addons\dayz_code\actions\forcesave.sqf"; /* Something went wrong, inform the player and refund the costs */ } else { if (_Price != "0") then { cutText["~~ Vehicle Keychange - FAIL ~~","PLAIN",1]; systemChat (format["Sorry something went wrong", keyNameSelect]); systemChat (format["Please try again. If it keeps failing, please contact a Admin!", keyNameSelect, _targetVehicleKeyName]); [player,_Price] call BIS_fnc_invAdd; systemChat (format["Refunded %1",_Price]); }; if (_claimingPrice != "0") then { cutText["~~ Vehicle Claiming - FAIL ~~","PLAIN",1]; systemChat ("Sorry something went wrong"); systemChat ("Please try again. If it keeps failing, please contact a Admin!"); [player,_claimingPrice] call BIS_fnc_invAdd; systemChat (format["Refunded %1",_claimingPrice]); }; }; }; /* Reset the action menu variables for a new run */ s_player_copyToKey = -1; s_player_claimVehicle = -1; /**************************************/ /* That's it, hope you enjoy this Mod */ /* */ /* Yours sincerly, */ /* Otter */ /**************************************/ With this code is the duping problem solved officially.No matter what actions one performs, one is always forced to quit the script :-)Perhaps otter nose takes over this variant in his Script.Best Regardshellraver Link to comment Share on other sites More sharing options...
hellraver Posted September 1, 2014 Report Share Posted September 1, 2014 Hi Guys!I have a new fix for the duping Problem.In this Variant does not must to click on "Exit" it.The script will now exit properly when you click on the right mouse button. /***********************************/ /* Vehicle Key Changer v1.4.1 */ /* Written by OtterNas3 */ /* January, 11, 2014 */ /* Last update: 01/09/2014 */ /* Edited: hellraver */ /***********************************/ /* Setup the private variables */ private ["_locationPlayer","_magazinesPlayer","_max","_j","_actionArray","_targetVehicle","_targetVehicleID","_targetVehicleUID","_playerKeys","_playerKeysDisplayName","_targetVehicleKeyName","_itemKeyName","_targetVehicleClassname","_targetVehiclePos","_targetVehicleDir","_Price","_claimingPrice","_timeout"]; /* Remove the Action Menu entry */ player removeAction s_player_copyToKey; s_player_copyToKey = 0; player removeAction s_player_claimVehicle; s_player_claimVehicle = 0; /* Get the array and setup the variables */ _actionArray = _this select 3; _targetVehicle = _actionArray select 0; _targetVehicleID = _targetVehicle getVariable ["ObjectID","0"]; _targetVehicleUID = _targetVehicle getVariable ["ObjectUID","0"]; /* Check if the Vehicle is in the Database, if false exit */ if (_targetVehicleID == "0" && _targetVehicleUID == "0") exitWith {cutText ["Sorry but\nthis Vehicle does not support\nKeychange/Claiming!","PLAIN",0];s_player_copyToKey = -1;s_player_claimVehicle = -1;}; /* Setup more variables */ _playerKeys = _actionArray select 1; _playerKeysDisplayName = _actionArray select 3; _targetVehicleKeyName = _actionArray select 4; _itemKeyName = _actionArray select 5; _Price = _actionArray select 6; _claimingPrice = _actionArray select 7; _targetVehicleClassname = typeOf _targetVehicle; _targetVehiclePos = getPosATL _targetVehicle; _targetVehicleDir = getDir _targetVehicle; /* Just in case it is a just bought vehicle and does not yet have a ObjectUID variable set */ if (_targetVehicleUID == "0") then { _targetVehicleUID = ""; { _x = _x * 10; if ( _x < 0 ) then { _x = _x * -10 }; _targetVehicleUID = _targetVehicleUID + str(round(_x)); } forEach _targetVehiclePos; _targetVehicleUID = _targetVehicleUID + str(round(_targetVehicleDir + time)); _targetVehicle setVariable["ObjectUID",_targetVehicleUID,true]; }; /* Setup the Key Names list to select from */ keyNameList = []; for "_i" from 0 to (count _playerKeysDisplayName) -1 do { keyNameList set [(count keyNameList), _playerKeysDisplayName select _i]; }; /* Setup the Key Numbers list to select from */ keyNumberList = []; for "_i" from 0 to (count _playerKeys) -1 do { keyNumberList set [(count keyNumberList), _playerKeys select _i]; }; /* Resetting menu variables*/ keyNameSelect = ""; exitscript = true; snext = false; /* Creating the menu */ copyMenu = { private ["_keyMenu","_keyArray"]; _keyMenu = [["",true], ["Select the new Key:", [-1], "", -5, [["expression", ""]], "1", "0"]]; for "_i" from (_this select 0) to (_this select 1) do { _keyArray = [format['%1', keyNameList select (_i)], [_i - (_this select 0) + 2], "", -5, [["expression", format ["keyNameSelect = keyNameList select %1; keyNumberSelect = keyNumberList select %1", _i]]], "1", "1"]; _keyMenu set [_i + 2, _keyArray]; }; _keyMenu set [(_this select 1) + 2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; if (count keyNameList > (_this select 1)) then { _keyMenu set [(_this select 1) + 3, ["Next", [12], "", -5, [["expression", "snext = true;"]], "1", "1"]]; } else { _keyMenu set [(_this select 1) + 3, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; }; _keyMenu set [(_this select 1) + 4, ["Exit", [13], "", -5, [["expression", "keyNameSelect = 'exitscript';"]], "1", "1"]]; showCommandingMenu "#USER:_keyMenu"; }; /* Wait for the player to select a Key from the list */ _j = 0; _max = 10; _locationPlayer = player modeltoworld [0,0,0]; if (_max > 9) then {_max = 10;}; while {keyNameSelect == ""} do { [_j, (_j + _max) min (count keyNameList)] call copyMenu; _j = _j + _max; waitUntil {keyNameSelect != "" || snext || player distance _locationPlayer > 0.2}; if (player distance _locationPlayer > 0.2) then { breakOut "exit"; }; snext = false; }; /* Player selected a Key, lets make the Vehicle update call */ if (keyNameSelect != "exitscript") then { /* Check again for the needed price or claiming price and remove em from the players inventory */ _magazinesPlayer = magazines player; if (_Price != "0") then { /* Player still has the costs in hi inventory */ if (_Price in _magazinesPlayer) then { [player, _Price, 1] call BIS_fnc_invRemove; systemChat (format["Keychange costs a %1, thanks for your Payment!", _Price]); /* Player doesn't have the costs anymore, tried to trick the system? */ } else { systemChat (format["Keychange costs a %1, you had it and tried to trick the system - Keychange for this Vehicle disabled!", _Price]); /* This disables the Keychange ability for this vehicle JUST for this Player */ /* However he can relog and try again but it is a little punishment for trying to trick it */ _targetVehicle setVariable ["VKC_disabled", 1]; s_player_copyToKey = -1; s_player_claimVehicle = -1; breakOut "exit"; }; }; if (_claimingPrice != "0") then { /* Player still has the costs in hi inventory */ if (_claimingPrice in _magazinesPlayer) then { [player, _claimingPrice, 1] call BIS_fnc_invRemove; systemChat (format["Claiming Vehicle costs a %1, thanks for your Payment!", _claimingPrice]); /* Player doesn't have the costs anymore, tried to trick the system? */ } else { systemChat (format["Claiming Vehicle costs a %1, you had it and tried to trick the system - Claiming for this Vehicle disabled!", Price]); /* This disables the Claiming ability for this vehicle JUST for this Player */ /* However he can relog and try again but it is a little punishment for trying to trick it */ _targetVehicle setVariable ["VKC_claiming_disabled", 1]; s_player_copyToKey = -1; s_player_claimVehicle = -1; breakOut "exit"; }; }; /* We got the Money lets do our Job */ /* Lock the vehicle */ _targetVehicle setVehicleLock "LOCKED"; /* The super duper OneForAllAnimation... */ player playActionNow "Medic"; /* Remove the Key from the Toolbelt of the player and put it in the Backpack - No Backpack and the Key gets lost */ if (_itemKeyName != "0") then { if (!isNull (unitBackpack player)) then { [player, _itemKeyName, 1] call BIS_fnc_invRemove; (unitBackpack (vehicle player)) addWeaponCargoGlobal [_itemKeyName, 1]; systemChat (format["%1 has been moved to your Backpack", _targetVehicleKeyName]); }; }; /* This calls the custom update function which we put it in server_updateObject.sqf */ PVDZE_veh_Update = [_targetVehicle, "vehiclekey", player, _targetVehicleClassname, keyNumberSelect, keyNameSelect, _targetVehicleID, _targetVehicleUID]; publicVariableServer "PVDZE_veh_Update"; /* Wait for success or timeout */ _timeout = 20; while {_timeout > 0 && isNil "PVDZE_vkc_Success"} do { if (_Price != "0") then { cutText["~~ Performing Keychange ~~\n~~ Please wait ~~","PLAIN",0.5]; }; if (_claimingPrice != "0") then { cutText["~~ Performing Claim ~~\n~~ Please wait ~~","PLAIN",0.5]; }; sleep 1; _timeout = _timeout - 1; }; /* Inform the player about the success and tell him to check the Key */ if (!isNil "PVDZE_vkc_Success") then { if (_Price != "0") then { cutText["~~ Vehicle Keychange - SUCCESS ~~","PLAIN",1]; systemChat (format["Changed Vehicle Key to %1", keyNameSelect]); systemChat (format["Please check Vehicle function with %1 before you throw away %2!", keyNameSelect, _targetVehicleKeyName]); }; if (_claimingPrice != "0") then { cutText["~~ Vehicle Claiming - SUCCESS ~~","PLAIN",1]; systemChat (format["You claimed this Vehicle with: %1", keyNameSelect]); }; PVDZE_vkc_Success = nil; /* This updates the Vehicle as it is now, position, gear, damage, fuel */ /* Should prevent the "backporting" some dudes reported. */ /* Just fyi i never had that but just in case... */ [nil,nil,nil,_targetVehicle] execVM "\z\addons\dayz_code\actions\forcesave.sqf"; /* Something went wrong, inform the player and refund the costs */ } else { if (_Price != "0") then { cutText["~~ Vehicle Keychange - FAIL ~~","PLAIN",1]; systemChat (format["Sorry something went wrong", keyNameSelect]); systemChat (format["Please try again. If it keeps failing, please contact a Admin!", keyNameSelect, _targetVehicleKeyName]); [player,_Price] call BIS_fnc_invAdd; systemChat (format["Refunded %1",_Price]); }; if (_claimingPrice != "0") then { cutText["~~ Vehicle Claiming - FAIL ~~","PLAIN",1]; systemChat ("Sorry something went wrong"); systemChat ("Please try again. If it keeps failing, please contact a Admin!"); [player,_claimingPrice] call BIS_fnc_invAdd; systemChat (format["Refunded %1",_claimingPrice]); }; }; }; /* Reset the action menu variables for a new run */ s_player_copyToKey = -1; s_player_claimVehicle = -1; /**************************************/ /* That's it, hope you enjoy this Mod */ /* */ /* Yours sincerly, */ /* Otter */ /**************************************/ Here the final Version and new Release as attached files which solves the problem with duping :-)GreetshellraverVehicleKeyChanger_v1.4.1.zip Ghostrider-GRG 1 Link to comment Share on other sites More sharing options...
SpearMintTrooper Posted September 1, 2014 Report Share Posted September 1, 2014 @SpearMintTrooper Sorry, my english is not perfect :-( I speak German but i could solve the problem with the duping. I managed to solve the problem so, what otter nase loudly does not go as we were talking in teamspeak. @all Please use this Code in the VehicleKeyChanger.sqf : /***********************************/ /* Vehicle Key Changer v1.4 */ /* Written by OtterNas3 */ /* January, 11, 2014 */ /* Last update: 06/15/2014 */ /***********************************/ /* Setup the private variables */ private ["_locationPlayer","_magazinesPlayer","_max","_j","_actionArray","_targetVehicle","_targetVehicleID","_targetVehicleUID","_playerKeys","_playerKeysDisplayName","_targetVehicleKeyName","_itemKeyName","_targetVehicleClassname","_targetVehiclePos","_targetVehicleDir","_Price","_claimingPrice","_timeout"]; /* Remove the Action Menu entry */ player removeAction s_player_copyToKey; s_player_copyToKey = 0; player removeAction s_player_claimVehicle; s_player_claimVehicle = 0; /* Get the array and setup the variables */ _actionArray = _this select 3; _targetVehicle = _actionArray select 0; _targetVehicleID = _targetVehicle getVariable ["ObjectID","0"]; _targetVehicleUID = _targetVehicle getVariable ["ObjectUID","0"]; /* Check if the Vehicle is in the Database, if false exit */ if (_targetVehicleID == "0" && _targetVehicleUID == "0") exitWith {cutText ["Sorry but\nthis Vehicle does not support\nKeychange/Claiming!","PLAIN",0];s_player_copyToKey = -1;s_player_claimVehicle = -1;}; /* Setup more variables */ _playerKeys = _actionArray select 1; _playerKeysDisplayName = _actionArray select 3; _targetVehicleKeyName = _actionArray select 4; _itemKeyName = _actionArray select 5; _Price = _actionArray select 6; _claimingPrice = _actionArray select 7; _targetVehicleClassname = typeOf _targetVehicle; _targetVehiclePos = getPosATL _targetVehicle; _targetVehicleDir = getDir _targetVehicle; /* Just in case it is a just bought vehicle and does not yet have a ObjectUID variable set */ if (_targetVehicleUID == "0") then { _targetVehicleUID = ""; { _x = _x * 10; if ( _x < 0 ) then { _x = _x * -10 }; _targetVehicleUID = _targetVehicleUID + str(round(_x)); } forEach _targetVehiclePos; _targetVehicleUID = _targetVehicleUID + str(round(_targetVehicleDir + time)); _targetVehicle setVariable["ObjectUID",_targetVehicleUID,true]; }; /* Setup the Key Names list to select from */ keyNameList = []; for "_i" from 0 to (count _playerKeysDisplayName) -1 do { keyNameList set [(count keyNameList), _playerKeysDisplayName select _i]; }; /* Setup the Key Numbers list to select from */ keyNumberList = []; for "_i" from 0 to (count _playerKeys) -1 do { keyNumberList set [(count keyNumberList), _playerKeys select _i]; }; /* Resetting menu variables*/ keyNameSelect = ""; exitscript = true; snext = false; /* Creating the menu */ copyMenu = { private ["_keyMenu","_keyArray"]; _keyMenu = [["",true], ["Select the new Key:", [-1], "", -5, [["expression", ""]], "1", "0"]]; for "_i" from (_this select 0) to (_this select 1) do { _keyArray = [format['%1', keyNameList select (_i)], [_i - (_this select 0) + 2], "", -5, [["expression", format ["keyNameSelect = keyNameList select %1; keyNumberSelect = keyNumberList select %1", _i]]], "1", "1"]; _keyMenu set [_i + 2, _keyArray]; }; _keyMenu set [(_this select 1) + 2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; if (count keyNameList > (_this select 1)) then { _keyMenu set [(_this select 1) + 3, ["Next", [12], "", -5, [["expression", "snext = true;"]], "1", "1"]]; } else { _keyMenu set [(_this select 1) + 3, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; }; _keyMenu set [(_this select 1) + 4, ["Exit", [13], "", -5, [["expression", "keyNameSelect = 'exitscript';"]], "1", "1"]]; showCommandingMenu "#USER:_keyMenu"; }; /* Wait for the player to select a Key from the list */ _j = 0; _max = 10; _locationPlayer = player modeltoworld [0,0,0]; if (_max > 9) then {_max = 10;}; while {keyNameSelect == ""} do { [_j, (_j + _max) min (count keyNameList)] call copyMenu; _j = _j + _max; waitUntil {keyNameSelect != "" || snext || player distance _locationPlayer > 0.2}; snext = false; }; /* Player selected a Key, lets make the Vehicle update call */ if (keyNameSelect != "exitscript") then { /* Check again for the needed price or claiming price and remove em from the players inventory */ _magazinesPlayer = magazines player; if (_Price != "0") then { /* Player still has the costs in hi inventory */ if (_Price in _magazinesPlayer) then { [player, _Price, 1] call BIS_fnc_invRemove; systemChat (format["Keychange costs a %1, thanks for your Payment!", _Price]); /* Player doesn't have the costs anymore, tried to trick the system? */ } else { systemChat (format["Keychange costs a %1, you had it and tried to trick the system - Keychange for this Vehicle disabled!", _Price]); /* This disables the Keychange ability for this vehicle JUST for this Player */ /* However he can relog and try again but it is a little punishment for trying to trick it */ _targetVehicle setVariable ["VKC_disabled", 1]; s_player_copyToKey = -1; s_player_claimVehicle = -1; breakOut "exit"; }; }; if (_claimingPrice != "0") then { /* Player still has the costs in hi inventory */ if (_claimingPrice in _magazinesPlayer) then { [player, _claimingPrice, 1] call BIS_fnc_invRemove; systemChat (format["Claiming Vehicle costs a %1, thanks for your Payment!", _claimingPrice]); /* Player doesn't have the costs anymore, tried to trick the system? */ } else { systemChat (format["Claiming Vehicle costs a %1, you had it and tried to trick the system - Claiming for this Vehicle disabled!", Price]); /* This disables the Claiming ability for this vehicle JUST for this Player */ /* However he can relog and try again but it is a little punishment for trying to trick it */ _targetVehicle setVariable ["VKC_claiming_disabled", 1]; s_player_copyToKey = -1; s_player_claimVehicle = -1; breakOut "exit"; }; }; /* We got the Money lets do our Job */ /* Lock the vehicle */ _targetVehicle setVehicleLock "LOCKED"; /* The super duper OneForAllAnimation... */ player playActionNow "Medic"; /* Remove the Key from the Toolbelt of the player and put it in the Backpack - No Backpack and the Key gets lost */ if (_itemKeyName != "0") then { if (!isNull (unitBackpack player)) then { [player, _itemKeyName, 1] call BIS_fnc_invRemove; (unitBackpack (vehicle player)) addWeaponCargoGlobal [_itemKeyName, 1]; systemChat (format["%1 has been moved to your Backpack", _targetVehicleKeyName]); }; }; /* This calls the custom update function which we put it in server_updateObject.sqf */ PVDZE_veh_Update = [_targetVehicle, "vehiclekey", player, _targetVehicleClassname, keyNumberSelect, keyNameSelect, _targetVehicleID, _targetVehicleUID]; publicVariableServer "PVDZE_veh_Update"; /* Wait for success or timeout */ _timeout = 20; while {_timeout > 0 && isNil "PVDZE_vkc_Success"} do { if (_Price != "0") then { cutText["~~ Performing Keychange ~~\n~~ Please wait ~~","PLAIN",0.5]; }; if (_claimingPrice != "0") then { cutText["~~ Performing Claim ~~\n~~ Please wait ~~","PLAIN",0.5]; }; sleep 1; _timeout = _timeout - 1; }; /* Inform the player about the success and tell him to check the Key */ if (!isNil "PVDZE_vkc_Success") then { if (_Price != "0") then { cutText["~~ Vehicle Keychange - SUCCESS ~~","PLAIN",1]; systemChat (format["Changed Vehicle Key to %1", keyNameSelect]); systemChat (format["Please check Vehicle function with %1 before you throw away %2!", keyNameSelect, _targetVehicleKeyName]); }; if (_claimingPrice != "0") then { cutText["~~ Vehicle Claiming - SUCCESS ~~","PLAIN",1]; systemChat (format["You claimed this Vehicle with: %1", keyNameSelect]); }; PVDZE_vkc_Success = nil; /* This updates the Vehicle as it is now, position, gear, damage, fuel */ /* Should prevent the "backporting" some dudes reported. */ /* Just fyi i never had that but just in case... */ [nil,nil,nil,_targetVehicle] execVM "\z\addons\dayz_code\actions\forcesave.sqf"; /* Something went wrong, inform the player and refund the costs */ } else { if (_Price != "0") then { cutText["~~ Vehicle Keychange - FAIL ~~","PLAIN",1]; systemChat (format["Sorry something went wrong", keyNameSelect]); systemChat (format["Please try again. If it keeps failing, please contact a Admin!", keyNameSelect, _targetVehicleKeyName]); [player,_Price] call BIS_fnc_invAdd; systemChat (format["Refunded %1",_Price]); }; if (_claimingPrice != "0") then { cutText["~~ Vehicle Claiming - FAIL ~~","PLAIN",1]; systemChat ("Sorry something went wrong"); systemChat ("Please try again. If it keeps failing, please contact a Admin!"); [player,_claimingPrice] call BIS_fnc_invAdd; systemChat (format["Refunded %1",_claimingPrice]); }; }; }; /* Reset the action menu variables for a new run */ s_player_copyToKey = -1; s_player_claimVehicle = -1; /**************************************/ /* That's it, hope you enjoy this Mod */ /* */ /* Yours sincerly, */ /* Otter */ /**************************************/ With this code is the duping problem solved officially. No matter what actions one performs, one is always forced to quit the script :-) Perhaps otter nose takes over this variant in his Script. Best Regards hellraver Cheers hellraver will test this shortly :-) Ghostrider-GRG 1 Link to comment Share on other sites More sharing options...
hellraver Posted September 1, 2014 Report Share Posted September 1, 2014 @Spearminttrooper See last post by me. I have a new fix for the duping problem. Downloadlink for the inofficial release 1.4.1 is included as attached files ;-) Perhaps also solves the the problem which you have described here. Greets hellraver Link to comment Share on other sites More sharing options...
SpearMintTrooper Posted September 3, 2014 Report Share Posted September 3, 2014 @Spearminttrooper See last post by me. I have a new fix for the duping problem. Downloadlink for the inofficial release 1.4.1 is included as attached files ;-) Perhaps also solves the the problem which you have described here. Greets hellraver @hellraver, Unfortunatly i am still getting the same message when using your updated version (Sorry something went wrong) Section from .rpt: 21:15:59 "HIVE: WRITE: VEHICLE KEY CHANGER: Vehicle:328f3040# 1062491: m998_crows.p3d NewKey:Yellow Key (b1a2) BY SpearMintPC(76561198046463162)" 21:16:00 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:63269768290109:"" 21:16:00 "CUSTOM: VEHICLE KEY CHANGER: Selected "2832"" I am at a real loss on this. Any more suggestions? Thanks Spear Link to comment Share on other sites More sharing options...
CMDR. Taco Posted September 4, 2014 Report Share Posted September 4, 2014 I installed the 1.4.1 and everything seems to be working ok, but I do see this in the client logs. Error in expression <ON_fnc_vkcReset = { player removeAction s_player_claimVehicle; s_player_claimVeh> Error position: <s_player_claimVehicle; s_player_claimVeh> Error Undefined variable in expression: s_player_claimvehicle File mpmissions\__CUR_MP.Chernarus\custom\VehicleKeyChanger\VehicleKeyChanger_init.sqf, line 41 @Spearminttrooper See last post by me. I have a new fix for the duping problem. Downloadlink for the inofficial release 1.4.1 is included as attached files ;-) Perhaps also solves the the problem which you have described here. Greets hellraver Link to comment Share on other sites More sharing options...
hellraver Posted September 4, 2014 Report Share Posted September 4, 2014 @CMDR. TacoI can not reproduce this error :-/ Which version of Arma use them? 1.63?Or have they changed in the VehicleKeyChanger_init.sqf something?Exists the error also in the 1.4 Version? I have not changed anything inthe VehicleKeyChanger_init.sqf Link to comment Share on other sites More sharing options...
cm_red000 Posted September 5, 2014 Report Share Posted September 5, 2014 Does anyone know how exactly the "claiming" part of this works? Is it possible to claim stolen vehicles? (i.e. using a hotwire kit to take another player's car, then claim it as your own?)Creating the master keys seems to work fine, but so far we've been unable to get the claiming to work even with the key maker's kit and key in inventory (have the claiming set to be free).Thanks in advance for any help :) Link to comment Share on other sites More sharing options...
P0k3r_OF_Sm0t Posted September 5, 2014 Report Share Posted September 5, 2014 Hi all, Been struggling with this one on my OverPoch server, Have re installed it a few time's now and same thing every time. i have the item's (both keys, Key makers kit, 20oz gold (left it on default settings for the mo)). Option comes up nicely in game at bottom of scroll menu, i select the option and then the key i want to change to. It then moves the unwanted key to BP and takes the gold. Next msg is Change Key Failed, (contact admin blabla.....) Refunds gold, Thats it, i have rooted through all the associated SQL's cant find anything outa place. Also bit odd i never see anything in the .RPT for it doing anything. Am i missing something simple or just being a duh......... Thanks for any advice Spear Just had a random thought, i am running OverPoch, will this need to go in the OverPoch mission or the Epoch mission? I had this problem once too after I installed another mod that replaced the server_updateobject.sqf. That's where your problem will be. SpearMintTrooper 1 Link to comment Share on other sites More sharing options...
P0k3r_OF_Sm0t Posted September 5, 2014 Report Share Posted September 5, 2014 Does anyone know how exactly the "claiming" part of this works? Is it possible to claim stolen vehicles? (i.e. using a hotwire kit to take another player's car, then claim it as your own?) Creating the master keys seems to work fine, but so far we've been unable to get the claiming to work even with the key maker's kit and key in inventory (have the claiming set to be free). Thanks in advance for any help :) I'm not at home so can't test, but I'm pretty sure I remember that you can only claim a vehicle that is a hive vehicle. I know you can't make a key for a map spawn using infistar, says vehicle has id of 0 and cannot be made. However, you should be able to claim a hotwired vehicle. Link to comment Share on other sites More sharing options...
SpearMintTrooper Posted September 5, 2014 Report Share Posted September 5, 2014 I had this problem once too after I installed another mod that replaced the server_updateobject.sqf. That's where your problem will be. @P0k3r_OF_Sm0t Any chance you could have a gander over my server_updateobject.sqf below, as i am still no closer to sorting this, think it needs a keener eye than mine. Thanks Spear Ok so im not aloud to make attachments yet. Sorry to fill the post up with script. /* [_object,_type] spawn server_updateObject; */ private ["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk","_parachuteWest","_firstTime","_object_killed","_object_repair","_isbuildable","_object_vehicleKey","_activatingPlayer","_vehicleClassname","_toKey","_toKeyName","_vehicle_ID","_vehicle_UID"]; _object = _this select 0; if(isNull(_object)) exitWith { diag_log format["Skipping Null Object: %1", _object]; }; _type = _this select 1; _parachuteWest = ((typeOf _object == "ParachuteWest") or (typeOf _object == "ParachuteC")); _isbuildable = (typeOf _object) in dayz_allowedObjects; _isNotOk = false; _firstTime = false; _objectID = _object getVariable ["ObjectID","0"]; _uid = _object getVariable ["ObjectUID","0"]; if ((typeName _objectID != "string") || (typeName _uid != "string")) then { diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]); //force fail _objectID = "0"; _uid = "0"; }; // Epoch Admin Tools if (_object getVariable "MalSar" == 1) exitWith {}; if (!_parachuteWest and !(locked _object)) then { if (_objectID == "0" && _uid == "0") then { _object_position = getPosATL _object; _isNotOk = true; }; }; // do not update if buildable and not ok if (_isNotOk and _isbuildable) exitWith { }; // delete if still not ok if (_isNotOk) exitWith { deleteVehicle _object; diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",typeOf _object,_object_position select 0,_object_position select 1, _object_position select 2]); }; _lastUpdate = _object getVariable ["lastUpdate",time]; _needUpdate = _object in needUpdate_objects; // TODO ---------------------- _object_position = { private["_position","_worldspace","_fuel","_key"]; _position = getPosATL _object; _worldspace = [ round(direction _object), _position ]; _fuel = 0; if (_object isKindOf "AllVehicles") then { _fuel = fuel _object; }; _key = format["CHILD:305:%1:%2:%3:", _objectID, _worldspace, _fuel]; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; }; _object_inventory = { private["_inventory","_previous","_key"]; _inventory = [ getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object ]; _previous = str(_object getVariable["lastInventory",[]]); if (str(_inventory) != _previous) then { _object setVariable["lastInventory",_inventory]; if (_objectID == "0") then { _key = format["CHILD:309:%1:%2:",_uid,_inventory]; } else { _key = format["CHILD:303:%1:%2:",_objectID,_inventory]; }; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; }; }; _object_damage = { private["_hitpoints","_array","_hit","_selection","_key","_damage"]; _hitpoints = _object call vehicle_getHitpoints; _damage = damage _object; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _object setHit ["_selection", _hit] } forEach _hitpoints; _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage]; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; _object setVariable ["needUpdate",false,true]; }; _object_killed = { private["_hitpoints","_array","_hit","_selection","_key","_damage"]; _hitpoints = _object call vehicle_getHitpoints; //_damage = damage _object; _damage = 1; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _hit = 1; _object setHit ["_selection", _hit] } forEach _hitpoints; if (_objectID == "0") then { _key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage]; } else { _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage]; }; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; _object setVariable ["needUpdate",false,true]; }; _object_repair = { private["_hitpoints","_array","_hit","_selection","_key","_damage"]; _hitpoints = _object call vehicle_getHitpoints; _damage = damage _object; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _object setHit ["_selection", _hit] } forEach _hitpoints; _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage]; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; _object setVariable ["needUpdate",false,true]; }; _object_vehicleKey = { private ["_hit","_selection","_fuel","_gotcha","_retry","_vehicleID","_key","_result","_outcome","_player","_class","_newKey","_newKeyName","_oldVehicleID","_oldVehicleUID","_hitpoints","_damage","_array","_inventory","_vehicleUID","_position","_dir","_worldspace"]; /* Setting up variables */ _player = _this select 0; _class = _this select 1; _newKey = _this select 2; _newKeyName = _this select 3; _oldVehicleID = _this select 4; _oldVehicleUID = _this select 5; /* Get Damage of the Vehicle */ _hitpoints = _object call vehicle_getHitpoints; _damage = damage _object; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _object setHit ["_selection", _hit]; } forEach _hitpoints; /* Get the Fuel of the Vehicle */ _fuel = 0; if (_object isKindOf "AllVehicles") then { _fuel = fuel _object; }; /* Get the Inventory of the Vehicle */ _inventory = [ getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object ]; /* Get the position of the Vehicle */ _position = getPosASL _object; if !(surfaceIsWater _position) then { _position = ASLToATL _position; }; _dir = getDir _object; _worldspace = [_dir,_position]; /* Delete the current Database entry */ [_oldVehicleID,_oldVehicleUID,_player] call server_deleteObj; sleep 1; /* Generate a new UID */ _vehicleUID = _worldspace call dayz_objectUID3; /* Write the new Database entry and LOG the action*/ _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _newKey, _worldspace, _inventory, _array, _fuel,_vehicleUID]; _key call server_hiveWrite; diag_log ("HIVE: WRITE: VEHICLE KEY CHANGER: "+ str(_key)); diag_log format["HIVE: WRITE: VEHICLE KEY CHANGER: Vehicle:%1 NewKey:%2 BY %3(%4)", _object, _newKeyName, (name _player), (getPlayerUID _player)]; /* Get the ObjectID of the entry in the Database */ _retry = 0; _gotcha = false; while {!_gotcha && _retry < 10} do { sleep 1; /* Send the request */ _key = format["CHILD:388:%1:",_vehicleUID]; diag_log ("HIVE: READ: VEHICLE KEY CHANGER: "+ str(_key)); _result = _key call server_hiveReadWrite; _outcome = _result select 0; /* We got a answer */ if (_outcome == "PASS") then { _vehicleID = _result select 1; /* Compare with old ObjectID to check if it not was deleted yet */ if (_oldVehicleID == _vehicleID) then { /* Not good lets give it another try */ _gotcha = false; _retry = _retry + 1; } else { /* GOTCHA! */ diag_log("CUSTOM: VEHICLE KEY CHANGER: Selected " + str(_vehicleID)); _gotcha = true; _retry = 11; _object setVariable ["VKC_disabled", 1,true]; _object setVariable ["VKC_claiming_disabled", 1,true]; [_object] spawn { private ["_veh"]; _veh = _this select 0; sleep 30; _veh setVariable ["VKC_disabled", 0,true]; _veh setVariable ["VKC_claiming_disabled", 0,true]; }; PVDZE_vkc_Success = true; (owner _player) publicVariableClient "PVDZE_vkc_Success"; /* Lock the Vehicle */ _object setVehicleLock "locked"; /* Save the ObjectID and ObjectUID to the vehicles variable and make it public */ _object setVariable ["ObjectID", _vehicleID, true]; _object setVariable ["ObjectUID", _vehicleUID, true]; /* Set the lastUpdate time to current */ _object setVariable ["lastUpdate",time,true]; /* Set the CharacterID to the new Key so we can access it! */ _object setVariable ["CharacterID", _newKey, true]; /* Some other variables you might need for disallow lift/tow/cargo locked Vehicles and such */ /* Uncomment if you use this */ /* R3F Arty and LOG block lift/tow/cargo locked vehicles*/ _object setVariable ["R3F_LOG_disabled",true,true]; /* =BTC= Logistic block lift locked vehicles*/ _object setVariable ["BTC_Cannot_Lift",true,true]; }; } else { /* Something went wrong on the request give it another try */ diag_log("CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: " + str(_vehicleUID)); _gotcha = false; _retry = _retry + 1; }; }; }; // TODO ---------------------- _object setVariable ["lastUpdate",time,true]; switch (_type) do { case "all": { call _object_position; call _object_inventory; call _object_damage; }; case "position": { if (!(_object in needUpdate_objects)) then { //diag_log format["DEBUG Position: Added to NeedUpdate=%1",_object]; needUpdate_objects set [count needUpdate_objects, _object]; }; }; case "gear": { call _object_inventory; }; case "damage": { if ( (time - _lastUpdate) > 5) then { call _object_damage; } else { if (!(_object in needUpdate_objects)) then { //diag_log format["DEBUG Damage: Added to NeedUpdate=%1",_object]; needUpdate_objects set [count needUpdate_objects, _object]; }; }; }; case "killed": { call _object_killed; }; case "repair": { call _object_damage; }; case "vehiclekey": { _activatingPlayer = _this select 2; _vehicleClassname = _this select 3; _toKey = _this select 4; _toKeyName = _this select 5; _vehicle_ID = _this select 6; _vehicle_UID = _this select 7; [_activatingPlayer, _vehicleClassname, _toKey, _toKeyName, _vehicle_ID, _vehicle_UID] call _object_vehicleKey;; }; }; Link to comment Share on other sites More sharing options...
P0k3r_OF_Sm0t Posted September 5, 2014 Report Share Posted September 5, 2014 @P0k3r_OF_Sm0t Any chance you could have a gander over my server_updateobject.sqf below, as i am still no closer to sorting this, think it needs a keener eye than mine. Thanks Spear Ok so im not aloud to make attachments yet. Sorry to fill the post up with script. /* [_object,_type] spawn server_updateObject; */ private ["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk","_parachuteWest","_firstTime","_object_killed","_object_repair","_isbuildable","_object_vehicleKey","_activatingPlayer","_vehicleClassname","_toKey","_toKeyName","_vehicle_ID","_vehicle_UID"]; _object = _this select 0; if(isNull(_object)) exitWith { diag_log format["Skipping Null Object: %1", _object]; }; _type = _this select 1; _parachuteWest = ((typeOf _object == "ParachuteWest") or (typeOf _object == "ParachuteC")); _isbuildable = (typeOf _object) in dayz_allowedObjects; _isNotOk = false; _firstTime = false; _objectID = _object getVariable ["ObjectID","0"]; _uid = _object getVariable ["ObjectUID","0"]; if ((typeName _objectID != "string") || (typeName _uid != "string")) then { diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]); //force fail _objectID = "0"; _uid = "0"; }; // Epoch Admin Tools if (_object getVariable "MalSar" == 1) exitWith {}; if (!_parachuteWest and !(locked _object)) then { if (_objectID == "0" && _uid == "0") then { _object_position = getPosATL _object; _isNotOk = true; }; }; // do not update if buildable and not ok if (_isNotOk and _isbuildable) exitWith { }; // delete if still not ok if (_isNotOk) exitWith { deleteVehicle _object; diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",typeOf _object,_object_position select 0,_object_position select 1, _object_position select 2]); }; _lastUpdate = _object getVariable ["lastUpdate",time]; _needUpdate = _object in needUpdate_objects; // TODO ---------------------- _object_position = { private["_position","_worldspace","_fuel","_key"]; _position = getPosATL _object; _worldspace = [ round(direction _object), _position ]; _fuel = 0; if (_object isKindOf "AllVehicles") then { _fuel = fuel _object; }; _key = format["CHILD:305:%1:%2:%3:", _objectID, _worldspace, _fuel]; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; }; _object_inventory = { private["_inventory","_previous","_key"]; _inventory = [ getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object ]; _previous = str(_object getVariable["lastInventory",[]]); if (str(_inventory) != _previous) then { _object setVariable["lastInventory",_inventory]; if (_objectID == "0") then { _key = format["CHILD:309:%1:%2:",_uid,_inventory]; } else { _key = format["CHILD:303:%1:%2:",_objectID,_inventory]; }; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; }; }; _object_damage = { private["_hitpoints","_array","_hit","_selection","_key","_damage"]; _hitpoints = _object call vehicle_getHitpoints; _damage = damage _object; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _object setHit ["_selection", _hit] } forEach _hitpoints; _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage]; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; _object setVariable ["needUpdate",false,true]; }; _object_killed = { private["_hitpoints","_array","_hit","_selection","_key","_damage"]; _hitpoints = _object call vehicle_getHitpoints; //_damage = damage _object; _damage = 1; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _hit = 1; _object setHit ["_selection", _hit] } forEach _hitpoints; if (_objectID == "0") then { _key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage]; } else { _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage]; }; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; _object setVariable ["needUpdate",false,true]; }; _object_repair = { private["_hitpoints","_array","_hit","_selection","_key","_damage"]; _hitpoints = _object call vehicle_getHitpoints; _damage = damage _object; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _object setHit ["_selection", _hit] } forEach _hitpoints; _key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage]; //diag_log ("HIVE: WRITE: "+ str(_key)); _key call server_hiveWrite; _object setVariable ["needUpdate",false,true]; }; _object_vehicleKey = { private ["_hit","_selection","_fuel","_gotcha","_retry","_vehicleID","_key","_result","_outcome","_player","_class","_newKey","_newKeyName","_oldVehicleID","_oldVehicleUID","_hitpoints","_damage","_array","_inventory","_vehicleUID","_position","_dir","_worldspace"]; /* Setting up variables */ _player = _this select 0; _class = _this select 1; _newKey = _this select 2; _newKeyName = _this select 3; _oldVehicleID = _this select 4; _oldVehicleUID = _this select 5; /* Get Damage of the Vehicle */ _hitpoints = _object call vehicle_getHitpoints; _damage = damage _object; _array = []; { _hit = [_object,_x] call object_getHit; _selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name"); if (_hit > 0) then {_array set [count _array,[_selection,_hit]]}; _object setHit ["_selection", _hit]; } forEach _hitpoints; /* Get the Fuel of the Vehicle */ _fuel = 0; if (_object isKindOf "AllVehicles") then { _fuel = fuel _object; }; /* Get the Inventory of the Vehicle */ _inventory = [ getWeaponCargo _object, getMagazineCargo _object, getBackpackCargo _object ]; /* Get the position of the Vehicle */ _position = getPosASL _object; if !(surfaceIsWater _position) then { _position = ASLToATL _position; }; _dir = getDir _object; _worldspace = [_dir,_position]; /* Delete the current Database entry */ [_oldVehicleID,_oldVehicleUID,_player] call server_deleteObj; sleep 1; /* Generate a new UID */ _vehicleUID = _worldspace call dayz_objectUID3; /* Write the new Database entry and LOG the action*/ _key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _newKey, _worldspace, _inventory, _array, _fuel,_vehicleUID]; _key call server_hiveWrite; diag_log ("HIVE: WRITE: VEHICLE KEY CHANGER: "+ str(_key)); diag_log format["HIVE: WRITE: VEHICLE KEY CHANGER: Vehicle:%1 NewKey:%2 BY %3(%4)", _object, _newKeyName, (name _player), (getPlayerUID _player)]; /* Get the ObjectID of the entry in the Database */ _retry = 0; _gotcha = false; while {!_gotcha && _retry < 10} do { sleep 1; /* Send the request */ _key = format["CHILD:388:%1:",_vehicleUID]; diag_log ("HIVE: READ: VEHICLE KEY CHANGER: "+ str(_key)); _result = _key call server_hiveReadWrite; _outcome = _result select 0; /* We got a answer */ if (_outcome == "PASS") then { _vehicleID = _result select 1; /* Compare with old ObjectID to check if it not was deleted yet */ if (_oldVehicleID == _vehicleID) then { /* Not good lets give it another try */ _gotcha = false; _retry = _retry + 1; } else { /* GOTCHA! */ diag_log("CUSTOM: VEHICLE KEY CHANGER: Selected " + str(_vehicleID)); _gotcha = true; _retry = 11; _object setVariable ["VKC_disabled", 1,true]; _object setVariable ["VKC_claiming_disabled", 1,true]; [_object] spawn { private ["_veh"]; _veh = _this select 0; sleep 30; _veh setVariable ["VKC_disabled", 0,true]; _veh setVariable ["VKC_claiming_disabled", 0,true]; }; PVDZE_vkc_Success = true; (owner _player) publicVariableClient "PVDZE_vkc_Success"; /* Lock the Vehicle */ _object setVehicleLock "locked"; /* Save the ObjectID and ObjectUID to the vehicles variable and make it public */ _object setVariable ["ObjectID", _vehicleID, true]; _object setVariable ["ObjectUID", _vehicleUID, true]; /* Set the lastUpdate time to current */ _object setVariable ["lastUpdate",time,true]; /* Set the CharacterID to the new Key so we can access it! */ _object setVariable ["CharacterID", _newKey, true]; /* Some other variables you might need for disallow lift/tow/cargo locked Vehicles and such */ /* Uncomment if you use this */ /* R3F Arty and LOG block lift/tow/cargo locked vehicles*/ _object setVariable ["R3F_LOG_disabled",true,true]; /* =BTC= Logistic block lift locked vehicles*/ _object setVariable ["BTC_Cannot_Lift",true,true]; }; } else { /* Something went wrong on the request give it another try */ diag_log("CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: " + str(_vehicleUID)); _gotcha = false; _retry = _retry + 1; }; }; }; // TODO ---------------------- _object setVariable ["lastUpdate",time,true]; switch (_type) do { case "all": { call _object_position; call _object_inventory; call _object_damage; }; case "position": { if (!(_object in needUpdate_objects)) then { //diag_log format["DEBUG Position: Added to NeedUpdate=%1",_object]; needUpdate_objects set [count needUpdate_objects, _object]; }; }; case "gear": { call _object_inventory; }; case "damage": { if ( (time - _lastUpdate) > 5) then { call _object_damage; } else { if (!(_object in needUpdate_objects)) then { //diag_log format["DEBUG Damage: Added to NeedUpdate=%1",_object]; needUpdate_objects set [count needUpdate_objects, _object]; }; }; }; case "killed": { call _object_killed; }; case "repair": { call _object_damage; }; case "vehiclekey": { _activatingPlayer = _this select 2; _vehicleClassname = _this select 3; _toKey = _this select 4; _toKeyName = _this select 5; _vehicle_ID = _this select 6; _vehicle_UID = _this select 7; [_activatingPlayer, _vehicleClassname, _toKey, _toKeyName, _vehicle_ID, _vehicle_UID] call _object_vehicleKey;; }; }; I'll compare it to mine when I get home from work in a few hours and see if I can find your problem. Link to comment Share on other sites More sharing options...
hellraver Posted September 5, 2014 Report Share Posted September 5, 2014 @SpearMintTrooper If they want I'm looking for the error for them? For this I need their mission.pbo and server.pbo file. I'm interested in arma scripting and would like very much to learn. Have until now all errors found. Soon I will write my first script :D I will a vehicle anti-theft alarms write with immobilizer. When player goes into the car and have not their vehicle key and start engine, the engine will going to off and the car will locked and a alarm sounds. Sorry for my bad english. Greetz hellraver SpearMintTrooper 1 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