Take ownership of a tent

Why not just change it so anyone can take a tent if they can see it? Seems bizarre that people can empty a tent of all the gear and yet not just take the tent too...

the Clenaupscript of dayz deletes tents after a while when the player is dead. Otherwise your server will fill up with tents over time. With the Take Owner Script Everyone can take all tents on Server, as they can take the ownership of ALL tents, not only the own tents. (Only own tent was an old idea :))
 
Quick and dirty tutorial:

Mission.pbo file:

create a file custom\takeOwnership.sqf

Code:
//take ownership of a tent. www.die-philosoffen.com - NeverUsedID
private["_survivorID","_objectUID","_key"];
 
_obj = _this select 3;
 
//get ObjetzUID from object
_objectUID    = _obj getVariable["ObjectUID","0"];
 
//get player who used take ownership
_survivorID  = dayz_characterID;
 
//set owner on clientsite
_obj setVariable ["characterID",dayz_characterID,true];
 
//set owner on sqlserver (it use a publicvariable in publicEH.sqf:
// "dayzChangeOwner" addPublicVariableEventHandler {_id = (_this select 1) spawn server_changeOwner}; //in serveronly section
dayzChangeOwner = [_survivorID, _objectUID];
publicVariable "dayzChangeOwner";
 
//send message to player
cuttext ["Owned tents do not despawn while your character is alive","PLAIN DOWN",2];

in your overwritten fn_selfActions.sqf add after "//Packing my tent" command:

Code:
 //take Ownership tent
    if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID != dayz_characterID) then {
        if ((s_player_takeOwnership < 0) and (player distance cursorTarget < 3)) then {
            s_player_takeOwnership = player addAction [("<t color=""#FF0000"">" + ("Take Ownership") + "</t>"), "custom\takeOwnership.sqf",cursorTarget, 1, false, true, "",""];
                        //s_player_takeOwnership = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",cursorTarget, 0, false, true, "",""];
        };
    } else {
        player removeAction s_player_takeOwnership;
        s_player_takeOwnership = -1;
        };

In your Server.pbo:

create new file compile\server_changeOwner.sqf

Code:
//Rafael TakeOwnership
/*
[_survivorID,_objectUID] spawn server_changeOwner;
*/
 
diag_log ("entering changeOwner...");
 
private ["_key","_survivorID","_objectUID"];
 
_survivorID = _this select 0;
_objectUID =    _this select 1;
_key = format["CHILD:999:UPDATE `instance_deployable` SET `owner_id` = '%1' WHERE `unique_id` = ?:[%2]:",_survivorID,_objectUID];
diag_log ("HIVE: WRITE: ChangedOwner "+ str(_key));
_result = _key call server_hiveReadWrite;
diag_log ("HIVE: RESULT: ChangedOwner "+ str(_result));

edit init\server_functions.sqf and add

Code:
server_changeOwner =        compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_changeOwner.sqf";

directly after:

Code:
server_spawnCrashSite  =    compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";

This code is serveripware :) That means if you use this code: post the server ip where this code is running in this thread.

you are forgot to tell about adding this in publicEH.sqf
Code:
 "dayzChangeOwner" addPublicVariableEventHandler {_id = (_this select 1) spawn server_changeOwner}; //in serveronly section
 
Doing all this coding for this seems silly .. Easyer way is to fully remove ownership over the tents so anyone can pack the them up .. Not sure why Dean Hall and the Dayz Dev team even placed ownership on the tents. Treat it like a car in the database all problems fixed.
 
Yes, but this wont be work with the cleanupscript from our Hoster. We had to Build our own cleanupscript on another Running Server. On this Way your tent will be Last forever if you are alive and tent from dead Players will be removed over Time.
@ jokaru: thx for Info. Will add It.
 
you are forgot to tell about adding this in publicEH.sqf
Code:
 "dayzChangeOwner" addPublicVariableEventHandler {_id = (_this select 1) spawn server_changeOwner}; //in serveronly section

Does this work for 1.7.7.1?
I'm new to this script stuff, and I can't seem to get this to work.
Do I need to edit publicEH.sqf? Where does it go?
 
Does this work for 1.7.7.1?
I'm new to this script stuff, and I can't seem to get this to work.
Do I need to edit publicEH.sqf? Where does it go?

Yes it works with 1.7.7.1 and bliss (no litesupport - if someone knows the hiveext.dll syntax for that please report !)
you will find the publciEH.sqf in dayz_code.dll.

Copy it to your mission pbo and change the init.sqf (or compile.sqf - dont know where publicEH is in) to the new path of the publiceh.sqf.

Then you can add the line dayzChangeOwner in the isServer bracket.
 
Yes it works with 1.7.7.1 and bliss (no litesupport - if someone knows the hiveext.dll syntax for that please report !)
you will find the publciEH.sqf in dayz_code.dll.

Copy it to your mission pbo and change the init.sqf (or compile.sqf - dont know where publicEH is in) to the new path of the publiceh.sqf.

Then you can add the line dayzChangeOwner in the isServer bracket.


Please bear with me, I am new to this...
Ok, I found PublicEH.sqf, but what section do I add the code in there? Does it matter?
You lost me with "add the line dayzChangeOwner in the isServer bracket". Where do I find this? Can you give me an example of how it should look?
 
you will find the publciEH.sqf in dayz_code.dll.

Copy it to your mission pbo and change the init.sqf (or compile.sqf - dont know where publicEH is in) to the new path of the publiceh.sqf.

I guessed and put "dayzChangeOwner" addPublicVariableEventHandler {_id = (_this select 1) spawn server_changeOwner}; under (isServer) bracket.
Problem is, when I changed the path for publicEH.sqf in the init.sqf to "\z\addons\dayz_mission\Custom\publicEH.sqf", I am getting an error message saying "Script \z\addons\dayz_mission\Custom\publicEH.sqf" not found. The file is definately there in the Custom folder.
 
Still not working...
I tried putting "[] ExecVM "Custom\publicEH.sqf"" at the end of the init.sqf to see if that works... No luck.
 
I'm wondering if there's something missing with the fn_selfActions.sqf and takeOwnership.sqf file?
Shouldn't there be something in the init.sqf under the dayz_mission folder to reference these two files?
 
Eureka!
Confirmed works for 1.7.7.1
Went through the code line by line, found a space between a "//" and that fixed it! That also fixed another script I was working on, hehe.
 
Well, the script is working fine for me, but had a buddy test it out and he's not getting the "take ownership" selection on a tent that was mine before I died.
Does this only work to reclaim your own tents after you die? I thought you'd be able to take over ownership of any tent whose owner died?
 
i could teach you a few things that will help you like , custom loadouts , spawnign vehicles, adding the ADmin backpack to admin characters, moving players etc... its all relatively simple hit me up on skype some time you have my skype name

WTF is this admin backpack you speak of!?
 
Well, the script is working fine for me, but had a buddy test it out and he's not getting the "take ownership" selection on a tent that was mine before I died.
Does this only work to reclaim your own tents after you die? I thought you'd be able to take over ownership of any tent whose owner died?

You have an antihack, don't you?

You have to whitelist the action, which I believe is something like s_player_takeOwnership or something
 
I haven't installed any antihack that I know of.
Found out later, he was able to take ownership of a tent I already took over ownership of. But he couldn't take ownership of an old tent of a dead player.
So it seems to be working, somewhat.
 
I haven't installed any antihack that I know of.
Found out later, he was able to take ownership of a tent I already took over ownership of. But he couldn't take ownership of an old tent of a dead player.
So it seems to be working, somewhat.

Hm. Your issue seemed like one that would be caused by not whitelisting in an anti hack, not sure.
 
Back
Top