Veh_unlock.sqf by Nebulazer? And where in compile I need write patch to veh_unlock.sqf?
I found this code in the Epoch Dayz_code
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Veh_unlock.sqf by Nebulazer? And where in compile I need write patch to veh_unlock.sqf?
private ["_object","_location","_dir","_worldspace","_objectID","_objectUID","_classname","_codeinput","_convertInput","_i","_stringInput","_numberInput","_fuel"];
_object = cursortarget;
_location = getposATL _object;
_dir = getDir _object;
_worldspace = [_dir,_location];
_objectID = _object getVariable["ObjectID","0"];
_objectUID = _object getVariable["ObjectUID","0"];
_classname = _object getVariable["Classname","0"];
_code = _object getVariable ["Code","0"];
//_objectUID = _worldspace call dayz_objectUID2;;
_codeinput = _this select 0;
sleep 3;
_convertInput =+ _codeinput;
for "_i" from 0 to (count _convertInput - 1) do {_convertInput set [_i, (_convertInput select _i) + 48]};
_numberInput = parseNumber (toString _convertInput);
if ( _numberInput > 10000 && _numberInput < 100000) then {
dayzDeleteObj = [_objectID,_objectUID];
publicVariableServer "dayzDeleteObj";
if (isServer) then {
dayzDeleteObj call server_deleteObj;
};
sleep 3;
_fuel = _numberInput / 100000;
_object setVariable ["characterID",dayz_playerUID,true];
dayzPublishObj = [dayz_playerUID,_object,[_dir,_location],_classname,_fuel,_code];
publicVariableServer "dayzPublishObj";
if (isServer) then {
dayzPublishObj call server_publishObj;
};
cutText [format["You have successfully changed your code to: %1",(toString _convertInput)], "PLAIN DOWN",1];
playsound "beep";
sleep 0.5;
playsound "beep";
sleep 0.5;
playsound "beep";
};
else { cutText ["Failed to change your code, please use exact 5 numbers!", "PLAIN DOWN"];breakOut "exit";
_codeinput = [];
};
_codeinput = [];
Here is a example of my future Change Keycode for BaseBuilding Script. It does nearly the same what you have to do (change one field in the database of a particular item).
Cause there is no CHILD:999 custom Hive Request at the DayZ Epoch Hive (I'm using that), I had to find another solution.
I ended up in a good way to overcome all this problems. If everything is alright and the script can be started, I do a request to the database to delete the object. Then I rewrite everything to the database with same data only with my modified field.
I don't use deletevehicle cause this would cause that the object wouldn't be there till next restart. I set everything via setVariable and getVariable and for restarts just set them again at servermonitor. I used the fuel field cause this field isn't used for normal buildings
In your case you need to change just Character_ID which is used to check if someones is the owner.
To restrict who can use this script I set that only owner can do this at buildables at the fn_selfactions.sqf
Here is my example script for MY case
Code:private ["_object","_location","_dir","_worldspace","_objectID","_objectUID","_classname","_codeinput","_convertInput","_i","_stringInput","_numberInput","_fuel"]; _object = cursortarget; _location = getposATL _object; _dir = getDir _object; _worldspace = [_dir,_location]; _objectID = _object getVariable["ObjectID","0"]; _objectUID = _object getVariable["ObjectUID","0"]; _classname = _object getVariable["Classname","0"]; _code = _object getVariable ["Code","0"]; //_objectUID = _worldspace call dayz_objectUID2;; _codeinput = _this select 0; sleep 3; _convertInput =+ _codeinput; for "_i" from 0 to (count _convertInput - 1) do {_convertInput set [_i, (_convertInput select _i) + 48]}; _numberInput = parseNumber (toString _convertInput); if ( _numberInput > 10000 && _numberInput < 100000) then { dayzDeleteObj = [_objectID,_objectUID]; publicVariableServer "dayzDeleteObj"; if (isServer) then { dayzDeleteObj call server_deleteObj; }; sleep 3; _fuel = _numberInput / 100000; _object setVariable ["characterID",dayz_playerUID,true]; dayzPublishObj = [dayz_playerUID,_object,[_dir,_location],_classname,_fuel,_code]; publicVariableServer "dayzPublishObj"; if (isServer) then { dayzPublishObj call server_publishObj; }; cutText [format["You have successfully changed your code to: %1",(toString _convertInput)], "PLAIN DOWN",1]; playsound "beep"; sleep 0.5; playsound "beep"; sleep 0.5; playsound "beep"; }; else { cutText ["Failed to change your code, please use exact 5 numbers!", "PLAIN DOWN"];breakOut "exit"; _codeinput = []; }; _codeinput = [];
I will later do complete tutorial for my BaseBuilding Improvement on my thread
http://opendayz.net/threads/project-basebuilding-1-2-change-code.10183/
This is all very awesome, but you might have accidentally put it in the wrong thread.
If you think that you're still on the wrong way
The same method as I use to edit only one field in the database without using a custom hive request can be used to write the owner of an vehicle into the database.
Normally there is no function to do that, only a function to publish a complete new object or streaming all informations to the server. So this solution in my example is working here, too. You delete the vehicle and readd it with further informations.
This solution is the only one I can think about to use for becoming permanent owner without a custom hive request over CHILD:999 (someone else maybe have another idea)
my bad, saw the stuff about basebuilding and i am following both threads, so i thought he might have mixed the 2 threads up... turns out it was me.
Would appricaite it. at the moment im having issues with every sript i write. the simplier scripts that contain just a cuttext work when i call them from self actions but my more advanced scripts arnt doing anything at all let alone the desired effect. pretty sure i have a syntax error or something somewhere causing it but i don't have any errors in my rpt. Gotta work this out before i work on this vehicle lock/unlock and btw i appricaite you guys letting me work on it with help even though it'd prolly be easier for one of you with more experience to just go ahead and do it lol.
wait local rpt?!? where is that located by default? i've been looking at the one in my servers ftp. could be my problem there lol!
Here is a example of my future Change Keycode for BaseBuilding Script. It does nearly the same what you have to do (change one field in the database of a particular item).
Cause there is no CHILD:999 custom Hive Request at the DayZ Epoch Hive (I'm using that), I had to find another solution.
I ended up in a good way to overcome all this problems. If everything is alright and the script can be started, I do a request to the database to delete the object. Then I rewrite everything to the database with same data only with my modified field.
I don't use deletevehicle cause this would cause that the object wouldn't be there till next restart. I set everything via setVariable and getVariable and for restarts just set them again at servermonitor. I used the fuel field cause this field isn't used for normal buildings
In your case you need to change just Character_ID which is used to check if someones is the owner.
To restrict who can use this script I set that only owner can do this at buildables at the fn_selfactions.sqf
Here is my example script for MY case
Code:private ["_object","_location","_dir","_worldspace","_objectID","_objectUID","_classname","_codeinput","_convertInput","_i","_stringInput","_numberInput","_fuel"]; _object = cursortarget; _location = getposATL _object; _dir = getDir _object; _worldspace = [_dir,_location]; _objectID = _object getVariable["ObjectID","0"]; _objectUID = _object getVariable["ObjectUID","0"]; _classname = _object getVariable["Classname","0"]; _code = _object getVariable ["Code","0"]; //_objectUID = _worldspace call dayz_objectUID2;; _codeinput = _this select 0; sleep 3; _convertInput =+ _codeinput; for "_i" from 0 to (count _convertInput - 1) do {_convertInput set [_i, (_convertInput select _i) + 48]}; _numberInput = parseNumber (toString _convertInput); if ( _numberInput > 10000 && _numberInput < 100000) then { dayzDeleteObj = [_objectID,_objectUID]; publicVariableServer "dayzDeleteObj"; if (isServer) then { dayzDeleteObj call server_deleteObj; }; sleep 3; _fuel = _numberInput / 100000; _object setVariable ["characterID",dayz_playerUID,true]; dayzPublishObj = [dayz_playerUID,_object,[_dir,_location],_classname,_fuel,_code]; publicVariableServer "dayzPublishObj"; if (isServer) then { dayzPublishObj call server_publishObj; }; cutText [format["You have successfully changed your code to: %1",(toString _convertInput)], "PLAIN DOWN",1]; playsound "beep"; sleep 0.5; playsound "beep"; sleep 0.5; playsound "beep"; }; else { cutText ["Failed to change your code, please use exact 5 numbers!", "PLAIN DOWN"];breakOut "exit"; _codeinput = []; }; _codeinput = [];
I will later do complete tutorial for my BaseBuilding Improvement on my thread
http://opendayz.net/threads/project-basebuilding-1-2-change-code.10183/
idk honestly. i use whatever dayz.st provides