Jump to content

[Release] 2.1 Plot Management - UPDATED Object Counter


Zupa

Recommended Posts

EDIT - Resolved below problem - had a potato moment and didnt change file location in self actions...another issue though ( i know its not the right topic) Advanced trader only shows up on a few merchants...is there something i need to change?

Ive got it installed and the scroll menu appears but when i click it doesnt open the interface....ive gone over it a couple of times but i cant seem to find an issue..my rpt logs give me nothing either..

 

it seems im getting the same issue for Advanced trader - I click the scroll wheel menu but it doesn't take me to the interface...

The only other mods im running are;

 

Build vectors (no P4L)

Advanced Trader

Plot Manager

 

any help would be great!

 

Link to comment
Share on other sites

For everyone NOT running Plot For LIfe and having issues with not being able to build/remove anything after you die, rosska provided this fix and it works flawlessly! Thanks heaps man, totally fixed my issue.

 

In your fn_selfactions, use this code : 

///Allow owners to delete modulars
if(_isModular) then {
        if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
            _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
            _IsNearPlot = count (_findNearestPoles);
            _fuid  = [];
            _allowed = [];
            if(_IsNearPlot > 0)then{
                _thePlot = _findNearestPoles select 0;
                _owner =  _thePlot getVariable ["ownerPUID","010"];
                _friends = _thePlot getVariable ["plotfriends", []];
                {
                  _friendUID = _x select 0;
                  _fuid  =  _fuid  + [_friendUID];
                } forEach _friends;
                _allowed = [_owner];    
                _allowed = [_owner] +  _fuid;   
                if ( _playerUID in _allowed && _ownerID in _allowed ) then {  // // If u want that the object also belongs to someone on the plotpole.
                    _player_deleteBuild = true;
                };                  
            }else{
                if(_ownerID == _playerUID)then{
                    _player_deleteBuild = true;
                };
            };                                        
        };
};
//Allow owners to delete modular doors without locks
if(_isModularDoor) then {
        if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {         
            _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
            _IsNearPlot = count (_findNearestPoles);
            _fuid  = [];
            _allowed = [];
            if(_IsNearPlot > 0)then{
                _thePlot = _findNearestPoles select 0;
                _owner =  _thePlot getVariable ["ownerPUID","010"];
                _friends = _thePlot getVariable ["plotfriends", []];
                {
                  _friendUID = _x select 0;
                  _fuid  =  _fuid  + [_friendUID];
                } forEach _friends;
                _allowed = [_owner];    
                _allowed = [_owner] +  _fuid;   
                if ( _playerUID in _allowed && _ownerID in _allowed) then { //  // If u want that the object also belongs to someone on the plotpole.
                    _player_deleteBuild = true;
                };                  
            }else{
                if(_ownerID == _playerUID)then{
                    _player_deleteBuild = true;
                };
            };                              
        };      
};

This is exactly what i have and still friends can't build on each others plot poles Nor the owner after they die. They can however remove and replace the plot pole and it is saving friends to the database so i'm at a quandry. Some where it seems to not be using the friendies list.not using P4L and PM default version. I may have missed a step.

Link to comment
Share on other sites

I believe my issue is with the player_build.sqf it seems the code that it checks after a player dies is based on characterID which changes on death. should it not be checking the friendlies list first for ownership?

 

// Since there are plots nearby we check for ownership && then for friend status
 
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
 
// Find owner
_ownerID = _nearestPole getVariable ["CharacterID","0"];
 
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
 
// check if friendly to owner
if(dayz_characterID == _ownerID) then {  //Keep ownership
// owner can build anything within his plot except other plots
if(!_isPole) then {
_canBuildOnPlot = true;
} else {
// disallow building plot
if(!_isPole) then {
_friendlies=_nearestPole getVariable ["plotfriends",[]];
_fuid  = [];
{
_friendUID = _x select 0;
_fuid  =  _fuid  + [_friendUID];
} forEach _friendlies;
_builder  = getPlayerUID player;
// check if friendly to owner
if(_builder in _fuid) then {
_canBuildOnPlot = true;
};
Link to comment
Share on other sites

Hello People

 

Just a quick  couple of questions as i'm new too the modding scene  :D

 

I would like to add 

 

snap-build pro

vector building

p4life

plot management

door management

and finally SCC

 

my questions are wich order would be best to fresh install the lot + which version of coin system will work for me

 

i'm running epoch 1.0.5.1 server through xampp for testing purposes but have over-watch mod installed too

 

TBH i'm helping my brother out he has a gtxgaming all in one server so will be transferring files to his server

 

forgot to mention i'm running napf map 

 

also prop's to all you modders you's are awesome

 

if i was to take an educated guess i would say after all the reading

 

install vector building as it has snap build pro and precice building

 

then p4life 

 

then plot management

 

then door management

 

and finally SCC but from reading looks like a mission to configure traders for napf 

Link to comment
Share on other sites

Got my issue sorted. Totally my bad.working perfectly thank you Zupa.

For those that may still have issues with building after death. the player_build.sqf i needed to modify was in the snapbuild folder in my mpmissions. i was extracting it from the dayz_code.pbo and moving it to plotmanagement but snap build player_build.sqf was called last so it controlled build actions.

Once i changed snapbuilds player_build everything started working great.

Link to comment
Share on other sites

Ok I am having an issue with the friends list after restarts. I can add myself and friends to a plot after placing it down. I can build just fine even after I die. The problem occurs when I restart my server. Upon logging in after restart I am no longer on my plot pulls friends list and I cannot readd myself. I can still manage the plot though. I am forced to remove the plot and place it back down to be able to add myself and others to the plot again. This happens after every restart.

 

I have plot4life 2.35 installed if that helps at all.

 

 

Link to comment
Share on other sites

Maybe I missed it in the multiple instructions files I looked at, but no where does it say what to do for server_monitor.sqf if you are using Door Management. I finally got smart, and realized Door Management was from Zupa as well, and I looked at the instructions for it! It says what to do if you are using Plot Management, however, if you install them in reverse order, you are left trying to pick your brain and compare files for a half hour trying to decide if what you are thinking you should change it to is correct, like I was doing. Anyway, could we get the steps below, added to the instructions by chance to help the next guys out? (Please double check it to make sure I pasted it correctly before you add it though, I make mistakes too :) )

 

IF USING DOOR MANAGEMENT (server_monitor.sqf)

 

Replace:

if ((count _intentory > 0) && !(typeOf( _object) in DZE_DoorsLocked)) then {

With

if ((count _intentory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ") && !(typeOf( _object) in DZE_DoorsLocked)) then {

Link to comment
Share on other sites

If you have Plot for Life, make sure you edit the correct server_monitor.sqf. The instructions say it is in dayz_server.pbo, when in fact P4L has a custom one in your servers root directory, under custom\System\. The server_monitor.sqf file in your server pbo is no longer referenced from init.sqf if you are using P4L. So don't waste your time editing that one. Edit the custom file, or things won't work right.

 

Note: I am using P4L v2.34 with snap pro, so just double check if this is still the case for P4L v2.5. If I was to guess, 2.5 still uses a custom server_monitor, but double check.

Link to comment
Share on other sites

I am having issues, followed all the instructions and using P4L, btw bualdoot, i dont have a server_monitor.sqf anywhere else besides in my dayz_server.pbo. anyway. Plot management doesnt work at all, there is no option for me to open up the GUI menu when i look at my plot pole. I have no errors in any of the logs i have. I followed everything in the instructions. I also have Admin Tools, Single Currency 3.0, and advanced trading installed. I understand they all have a defines.hpp but i merged them together and they seem to work just fine, no errors with them. also my advanced trading doesnt work either so i dont know whats going on. 

Link to comment
Share on other sites

So I've been trying to get this working for some time now, but I keep hitting the exact same issue time after time.

 

if ((count _intentory > 0) && !(typeOf( _object) ==>

 1:31:09   Error position: <_intentory > 0) && !(typeOf( _object) ==>
 1:31:09   Error Undefined variable in expression: _intentory
 1:31:09 File z\addons\dayz_server\system\server_monitor.sqf, line 246

 1:31:09 Error in expression <["OEMPos", _pos, true];

It repeats that very same thing over 300 times in a row in the logs.

 

Here's the file server_monitor.sqf file (I put the section it mentions in bold and underlined):

private ["_nul","_result","_pos","_wsDone","_dir","_isOK","_countr","_objWpnTypes","_objWpnQty","_dam","_selection","_totalvehicles","_object","_idKey","_type","_ownerID","_worldspace","_inventory","_hitPoints","_fuel","_damage","_key","_vehLimit","_hiveResponse","_objectCount","_codeCount","_data","_status","_val","_traderid","_retrader","_traderData","_id","_lockable","_debugMarkerPosition","_vehicle_0","_bQty","_vQty","_BuildingQueue","_objectQueue","_superkey","_shutdown","_res","_hiveLoaded"];

 
dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");
 
_hiveLoaded = false;
 
waitUntil{initialized}; //means all the functions are now defined
 
diag_log "HIVE: Starting";
 
waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)
 
// Custom Configs
if(isnil "MaxVehicleLimit") then {
MaxVehicleLimit = 50;
};
 
if(isnil "MaxDynamicDebris") then {
MaxDynamicDebris = 100;
};
if(isnil "MaxAmmoBoxes") then {
MaxAmmoBoxes = 3;
};
if(isnil "MaxMineVeins") then {
MaxMineVeins = 50;
};
// Custon Configs End
 
if (isServer && isNil "sm_done") then {
 
serverVehicleCounter = [];
_hiveResponse = [];
 
for "_i" from 1 to 5 do {
diag_log "HIVE: trying to get objects";
_key = format["CHILD:302:%1:", dayZ_instance];
_hiveResponse = _key call server_hiveReadWrite;  
if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
if ((_hiveResponse select 1) == "Instance already initialized") then {
_superkey = profileNamespace getVariable "SUPERKEY";
_shutdown = format["CHILD:400:%1:", _superkey];
_res = _shutdown call server_hiveReadWrite;
diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));
} else {
diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
 
};
_hiveResponse = ["",0];
else {
diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
_i = 99; // break
};
};
 
_BuildingQueue = [];
_objectQueue = [];
 
if ((_hiveResponse select 0) == "ObjectStreamStart") then {
 
// save superkey
profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];
 
_hiveLoaded = true;
 
diag_log ("HIVE: Commence Object Streaming...");
_key = format["CHILD:302:%1:", dayZ_instance];
_objectCount = _hiveResponse select 1;
_bQty = 0;
_vQty = 0;
for "_i" from 1 to _objectCount do {
_hiveResponse = _key call server_hiveReadWriteLarge;
//diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
if ((_hiveResponse select 2) isKindOf "ModularItems") then {
_BuildingQueue set [_bQty,_hiveResponse];
_bQty = _bQty + 1;
} else {
_objectQueue set [_vQty,_hiveResponse];
_vQty = _vQty + 1;
};
};
diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
};
 
// # NOW SPAWN OBJECTS #
_totalvehicles = 0;
// EVAC CHOPPER //
PVDZE_EvacChopperFields = [];
{
_idKey = _x select 1;
_type = _x select 2;
_ownerID = _x select 3;
 
_worldspace = _x select 4;
_inventory = _x select 5;
_hitPoints = _x select 6;
_fuel = _x select 7;
_damage = _x select 8;
 
_dir = 0;
_pos = [0,0,0];
_wsDone = false;
if (count _worldspace >= 2) then
{
_dir = _worldspace select 0;
if (count (_worldspace select 1) == 3) then {
_pos = _worldspace select 1;
_wsDone = true;
}
};
 
if (!_wsDone) then {
if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
};
 
//Vector Build
_vector = [[0,0,0],[0,0,0]];
_vecExists = false;
_ownerPUID = "0";   
if (count _worldspace >= 3) then{
if(count _worldspace == 3) then{
if(typename (_worldspace select 2) == "STRING")then{
_ownerPUID = _worldspace select 2;
}else{
if(typename (_worldspace select 2) == "ARRAY")then{
_vector = _worldspace select 2;
if(count _vector == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
_vecExists = true;
};
};
};                  
};
 
}else{
//Was not 3 elements, so check if 4 or more
if(count _worldspace == 4) then{
if(typename (_worldspace select 3) == "STRING")then{
_ownerPUID = _worldspace select 3;
}else{
if(typename (_worldspace select 2) == "STRING")then{
_ownerPUID = _worldspace select 2;
};
};
 
 
if(typename (_worldspace select 2) == "ARRAY")then{
_vector = _worldspace select 2;
if(count _vector == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
_vecExists = true;
};
};
}else{
if(typename (_worldspace select 3) == "ARRAY")then{
_vector = _worldspace select 3;
if(count _vector == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
_vecExists = true;
};
};
};
};
 
}else{
//More than 3 or 4 elements found
//Might add a search for the vector, ownerPUID will equal 0
};
};
}; 
if (_damage < 1) then {
//diag_log format["OBJ: %1 - %2", _idKey,_type];
 
//Create it
_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectID", _idKey, true];
 
if (typeOf (_object) == "Plastic_Pole_EP1_DZ") then {
_object setVariable ["plotfriends", _intentory, true];
};
 
_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
_lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
};
 
// fix for leading zero issues on safe codes after restart
if (_lockable == 4) then {
_codeCount = (count (toArray _ownerID));
if(_codeCount == 3) then {
_ownerID = format["0%1", _ownerID];
};
if(_codeCount == 2) then {
_ownerID = format["00%1", _ownerID];
};
if(_codeCount == 1) then {
_ownerID = format["000%1", _ownerID];
};
};
 
if (_lockable == 3) then {
_codeCount = (count (toArray _ownerID));
if(_codeCount == 2) then {
_ownerID = format["0%1", _ownerID];
};
if(_codeCount == 1) then {
_ownerID = format["00%1", _ownerID];
};
};
 
_object setVariable ["CharacterID", _ownerID, true];
 
clearWeaponCargoGlobal  _object;
clearMagazineCargoGlobal  _object;
// _object setVehicleAmmo DZE_vehicleAmmo;
 
_object setdir _dir;
if(_vecExists)then{
_object setVectorDirAndUp _vector;
}; 
_object setposATL _pos;
_object setDamage _damage;
 
if ((typeOf _object) == "HeliHRescue") then {
PVDZE_EvacChopperFields set [count PVDZE_EvacChopperFields, _object];
};
if ((typeOf _object) in dayz_allowedObjects) then {
_object setVariable["memDir",_dir,true];
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
} else {
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
// used for inplace upgrades && lock/unlock of safe
_object setVariable ["OEMPos", _pos, true];
 
};
 
if ((count _intentory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ")) then {
 
/*ZSC*/
if( count (_inventory) > 3)then{
_object setVariable ["bankMoney", _inventory select 3, true];
}else{
_object setVariable ["bankMoney", 0, true];
};
/*ZSC*/
 
if (_type in DZE_LockedStorage) then {
// Fill variables with loot
_object setVariable ["WeaponCargo", (_inventory select 0),true];
_object setVariable ["MagazineCargo", (_inventory select 1),true];
_object setVariable ["BackpackCargo", (_inventory select 2),true];
} else {
 
//Add weapons
_objWpnTypes = (_inventory select 0) select 0;
_objWpnQty = (_inventory select 0) select 1;
_countr = 0;
{
if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
_x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
};
_isOK = isClass(configFile >> "CfgWeapons" >> _x);
if (_isOK) then {
_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} count _objWpnTypes; 
 
//Add Magazines
_objWpnTypes = (_inventory select 1) select 0;
_objWpnQty = (_inventory select 1) select 1;
_countr = 0;
{
if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
if (_x == "ItemTent") then { _x = "ItemTentOld" };
_isOK = isClass(configFile >> "CfgMagazines" >> _x);
if (_isOK) then {
_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} count _objWpnTypes;
 
//Add Backpacks
_objWpnTypes = (_inventory select 2) select 0;
_objWpnQty = (_inventory select 2) select 1;
_countr = 0;
{
_isOK = isClass(configFile >> "CfgVehicles" >> _x);
if (_isOK) then {
_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} count _objWpnTypes;
};
};
 
if (_object isKindOf "AllVehicles") then {
_object setVariable ["lastInventory", _inventory];
{
_selection = _x select 0;
_dam = _x select 1;
if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
[_object,_selection,_dam] call object_setFixServer;
} count _hitpoints;
 
_object setFuel _fuel;
 
if (!((typeOf _object) in dayz_allowedObjects)) then {
 
//_object setvelocity [0,0,1];
_object call fnc_veh_ResetEH;
 
if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
_object setvehiclelock "locked";
_object setVariable ["R3F_LOG_disabled",true,true];
_object setVariable ["BTC_Cannot_Lift",true,true];
_object setVariable ["MF_Tow_Cannot_Tow",true,true];
};
 
_totalvehicles = _totalvehicles + 1;
 
// total each vehicle
serverVehicleCounter set [count serverVehicleCounter,_type];
};
};
 
//Monitor the object
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
};
} count (_BuildingQueue + _objectQueue);
// # END SPAWN OBJECTS #
 
// preload server traders menu data into cache
if !(DZE_ConfigTrader) then {
{
// get tids
_traderData = call compile format["menu_%1;",_x];
if(!isNil "_traderData") then {
{
_traderid = _x select 1;
 
_retrader = [];
 
_key = format["CHILD:399:%1:",_traderid];
_data = "HiveEXT" callExtension _key;
 
//diag_log "HIVE: Request sent";
 
//Process result
_result = call compile format ["%1",_data];
_status = _result select 0;
 
if (_status == "ObjectStreamStart") then {
_val = _result select 1;
//Stream Objects
//diag_log ("HIVE: Commence Menu Streaming...");
call compile format["ServerTcache_%1 = [];",_traderid];
for "_i" from 1 to _val do {
_data = "HiveEXT" callExtension _key;
_result = call compile format ["%1",_data];
call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
_retrader set [count _retrader,_result];
};
//diag_log ("HIVE: Streamed " + str(_val) + " objects");
};
 
} forEach (_traderData select 0);
};
} forEach serverTraders;
};
 
if (_hiveLoaded) then {
//  spawn_vehicles
_vehLimit = MaxVehicleLimit - _totalvehicles;
if(_vehLimit > 0) then {
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
for "_x" from 1 to _vehLimit do {
[] spawn spawn_vehicles;
};
} else {
diag_log "HIVE: Vehicle Spawn limit reached!";
};
};
 
//  spawn_roadblocks
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
for "_x" from 1 to MaxDynamicDebris do {
[] spawn spawn_roadblocks;
};
//  spawn_ammosupply at server start 1% of roadblocks
diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
for "_x" from 1 to MaxAmmoBoxes do {
[] spawn spawn_ammosupply;
};
// call spawning mining veins
diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
for "_x" from 1 to MaxMineVeins do {
[] spawn spawn_mineveins;
};
 
if(isnil "dayz_MapArea") then {
dayz_MapArea = 10000;
};
if(isnil "HeliCrashArea") then {
HeliCrashArea = dayz_MapArea / 2;
};
if(isnil "OldHeliCrash") then {
OldHeliCrash = false;
};
 
// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
if(OldHeliCrash) then {
_nul = [3, 4, (50 * 60), (15 * 60), 0.99, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
};
if (isDedicated) then {
// Epoch Events
_id = [] spawn server_spawnEvents;
// server cleanup
[] spawn {
private ["_id"];
sleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
waitUntil {!isNil "server_spawnCleanAnimals"};
_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
};
 
// spawn debug box
_debugMarkerPosition = getMarkerPos "respawn_west";
_debugMarkerPosition = [(_debugMarkerPosition select 0),(_debugMarkerPosition select 1),1];
_vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"];
_vehicle_0 setPos _debugMarkerPosition;
_vehicle_0 setVariable ["ObjectID","1",true];
 
// max number of spawn markers
if(isnil "spawnMarkerCount") then {
spawnMarkerCount = 10;
};
actualSpawnMarkerCount = 0;
// count valid spawn marker positions
for "_i" from 0 to spawnMarkerCount do {
if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then {
actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
} else {
// exit since we did not find any further markers
_i = spawnMarkerCount + 99;
};
 
};
diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
 
endLoadingScreen;
};
/*MISSIONS & AI*/
 
//DZAI
[] call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZAI\init\dzai_initserver.sqf";
 
//WAI
ExecVM "\z\addons\dayz_server\WAI\init.sqf";
 
//EMS
[] ExecVM "\z\addons\dayz_server\EMS\DZMSInit.sqf";
 
/*MISSIONS & AI END*/
allowConnection = true;
sm_done = true;
publicVariable "sm_done";
};
 
if (isServer && (isNil "EvacServerPreload")) then {
    publicVariable "PVDZE_EvacChopperFields";
    
    ON_fnc_evacChopperFieldsUpdate = {
        private ["_action","_targetField"];
        _action = _this select 0;
        _targetField = _this select 1;
        
        if (_action == "add") then {
            PVDZE_EvacChopperFields = PVDZE_EvacChopperFields + [_targetField];
        };
        
        if (_action == "rem") then {
            PVDZE_EvacChopperFields = PVDZE_EvacChopperFields - [_targetField];
        };
        
        publicVariable "PVDZE_EvacChopperFields";
    };
 
    "PVDZE_EvacChopperFieldsUpdate" addPublicVariableEventHandler {(_this select 1) spawn ON_fnc_evacChopperFieldsUpdate};
 
    EvacServerPreload = true;
};

.

 

Any help would be fantastic. I'm banging my head against a wall right now. Thanks!

Link to comment
Share on other sites

Dude, this has literally been covered a million times both on the forums and this thread itself.

if ((count _intentory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ")) then {
 
/*ZSC*/
if( count (_inventory) > 3)then{
_object setVariable ["bankMoney", _inventory select 3, true];
}else{
_object setVariable ["bankMoney", 0, true];
};
/*ZSC*/ 

Go through your server_monitor.sqf and change every instance of : 

intentory

with 

inventory
Link to comment
Share on other sites

 

Dude, this has literally been covered a million times both on the forums and this thread itself.

if ((count _intentory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ")) then {
 
/*ZSC*/
if( count (_inventory) > 3)then{
_object setVariable ["bankMoney", _inventory select 3, true];
}else{
_object setVariable ["bankMoney", 0, true];
};
/*ZSC*/ 

Go through your server_monitor.sqf and change every instance of : 

intentory

with 

inventory

 

Hi, thanks for your help! That did clear up that error. 

 

However, I'm still not getting an option when scrolling on plotpoles for the management. :/

 

Cheers for your help! :)

Link to comment
Share on other sites

Are you getting any errors in either RPT?

ErrorMessage: File mpmissions\DayZ_Epoch_11.Chernarus\plotManagement\plotManagement.hpp, line 27: /PlotManagement/Controls.RscShortcutButton_7009: Undefined base class 'Zupa_RscButtonMenu'

 

I get this error. If I remove this (and more from the plotManagement.hpp), the server starts. If I don't remove them, it doesn't.

 

That files:

class PlotManagement

{

idd = 711194;

onLoad = "uiNamespace setVariable ['PlotManagement', _this select 0]";

class Controls {

class RscText_7000: RscTextT

{

idc = 7000;

x = 0.30 * safezoneW + safezoneX;

y = 0.15 * safezoneH + safezoneY;

w = 0.30 * safezoneW;

h = 0.65 * safezoneH;

colorBackground[] = {0,0,0,0.8};

};

class RscText_7007: RscTextT

{

idc = 7007;

text = "Plot Management";

x = 0.30 * safezoneW + safezoneX;

y = 0.15 * safezoneH + safezoneY;

w = 0.30 * safezoneW;

h = 0.05 * safezoneH;

colorBackground[] = {0,0,0,0.8};

colorText[] = {1,1,1,1};

};

class RscShortcutButton_7009: Zupa_RscButtonMenu

{

idc = -1;

text = "Dome";

x = 0.31 * safezoneW + safezoneX;

y = 0.22 * safezoneH + safezoneY;

w = 0.08 * safezoneW;

onButtonClick = "call PlotPreview;";

};

class RscShortcutButton_7010: Zupa_RscButtonMenu

{

idc = -1;

text = "Refresh";

x = 0.41 * safezoneW + safezoneX;

y = 0.22 * safezoneH + safezoneY;

w = 0.08 * safezoneW;

onButtonClick = "[""preview""] call MaintainPlot;";

};

class RscShortcutButton_7011: Zupa_RscButtonMenu

{

idc = -1;

text = "Maintain";

x = 0.51 * safezoneW + safezoneX;

y = 0.22 * safezoneH + safezoneY;

w = 0.08 * safezoneW;

onButtonClick = "[""maintain""] call MaintainPlot;";

};

class RscText_7012: RscTextT

{

idc = 7012;

text = "";

x = 0.31 * safezoneW + safezoneX;

y = 0.30 * safezoneH + safezoneY;

w = 0.30 * safezoneW;

h = 0.05 * safezoneH;

colorText[] = {1,1,1,1};

};

class RscText_7014: RscStructuredText

{

idc = 7014;

text = "";

x = 0.30 * safezoneW + safezoneX;

y = 0.15 * safezoneH + safezoneY;

w = 0.30 * safezoneW;

h = 0.03 * safezoneH;

class Attributes {

align = "right";

};

};

class RscText_7013: RscTextT

{

idc = 7013;

text = "";

x = 0.31 * safezoneW + safezoneX;

y = 0.33 * safezoneH + safezoneY;

w = 0.30 * safezoneW;

h = 0.03 * safezoneH;

colorText[] = {1,1,1,1};

};

class RscText_7008: RscTextT

{

idc = -1;

text = "Humans Nearby";

x = 0.31 * safezoneW + safezoneX;

y = 0.38 * safezoneH + safezoneY;

w = 0.13 * safezoneW;

h = 0.03 * safezoneH;

colorText[] = {1,1,1,1};

};

class RscText_7003: RscTextT

{

idc = -1;

text = "PlotFriends";

x = 0.45 * safezoneW + safezoneX;

y = 0.38 * safezoneH + safezoneY;

w = 0.13 * safezoneW;

h = 0.03 * safezoneH;

colorText[] = {1,1,1,1};

};

class RscListbox_7001: RscListbox

{

idc = 7001;

x = 0.31* safezoneW + safezoneX;

y = 0.41 * safezoneH + safezoneY;

w = 0.13 * safezoneW;

h = 0.30 * safezoneH;

soundSelect[] = {"",0.1,1};

colorBackground[] = {0.1,0.1,0.1,0.8};

};

class RscListbox_7002: RscListbox

{

idc = 7002;

x = 0.45 * safezoneW + safezoneX;

y = 0.41* safezoneH + safezoneY;

w = 0.13 * safezoneW;

h = 0.30 * safezoneH;

soundSelect[] = {"",0.1,1};

colorBackground[] = {0.1,0.1,0.1,0.8};

};

class RscShortcutButton_7004: Zupa_RscButtonMenu

{

idc = -1;

text = "Add";

x = 0.33 * safezoneW + safezoneX;

y = 0.70 * safezoneH + safezoneY;

w = 0.08 * safezoneW;

onButtonClick = "[(lbCurSel 7001)] call PlotAddFriend;";

};

class RscShortcutButton_7005: Zupa_RscButtonMenu

{

idc = -1;

text = "Delete";

x = 0.47 * safezoneW + safezoneX;

y = 0.70 * safezoneH + safezoneY;

w = 0.08 * safezoneW;

onButtonClick = "[(lbCurSel 7002)] call PlotRemoveFriend;";

};

class RscShortcutButton_7006: Zupa_RscButtonMenu

{

idc = -1;

text = "Close";

x = 0.40 * safezoneW + safezoneX;

y = 0.74 * safezoneH + safezoneY;

w = 0.08 * safezoneW;

onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";

};

};

};

Link to comment
Share on other sites

 

What other stuff have you got installed that required you to edit your description.ext file?

 

Do you have these lines in your description.ext?

#include "plotManagement\defines.hpp"
#include "plotManagement\plotManagement.hpp"

 

Quite a few things, including Snap, Group Management and Advanced Trading. And I do have those in my description.ext.

 

I've been going at this for hours and hours on end and I just cannot find the issue, so I appreciate your help. Any file you need to see, I'll put here within the spoiler tags. 

 

Cheers again. :)

 

EDIT:

 

So I've been able to get the server running without removing anything from the define file, but the option still isn't showing when scrolling on the plotpole.

 

I am getting this error in my rpt:

0:53:38 Error in expression <o _object,

getBackpackCargo _object
];
};
];
_previous = str(_object getVariable>
 0:53:38   Error position: <;
];
_previous = str(_object getVariable>
 0:53:38   Error Missing ]
 0:53:38 File z\addons\dayz_server\compile\server_updateObject.sqf, line 81
 0:53:38 Error in expression <o _object,
getBackpackCargo _object
];
};
];
_previous = str(_object getVariable>
 0:53:38   Error position: <;
];
_previous = str(_object getVariable>
 0:53:38   Error Missing ]

Honestly not 100% sure where it wants this. And could it be the reason for the option not showing on the plotpoles?
 
The updateObject.sqf (with the area it mentions in bold):

/*
[_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") || (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";
};
if (!_parachuteWest && !(locked _object)) then {
if (_objectID == "0" && _uid == "0") then
{
_object_position = getPosATL _object;
    _isNotOk = true;
};
};
 
// added for custom missions
if (_object getVariable "Mission" == 1) exitWith {};
if (_object getVariable "Sarge" == 1) exitWith {};
if (_object getVariable "DZMSUnitsMinor" == 1) exitWith {};
if (_object getVariable "DZMSUnitsMajor" == 1) exitWith {};
if (_object getVariable "MalSar" == 1) exitWith {};
 
// do not update if buildable && not ok
if (_isNotOk && _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 = [
if (typeOf (_object) == "Plastic_Pole_EP1_DZ") then{
    _inventory = _object getVariable ["plotfriends", []]; //We're replacing the inventory with UIDs for this item
} else {
    _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];
} count _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];
} count _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];
if ((count _this) > 2) then {
_killer = _this select 2;
_charID = _object getVariable ['CharacterID','0'];
_objID = _object getVariable['ObjectID','0'];
_objUID = _object getVariable['ObjectUID','0'];
_worldSpace = getPosATL _object;
if (getPlayerUID _killer != "") then {
_name = if (alive _killer) then { name _killer; } else { format["OBJECT %1", _killer]; };
diag_log format["Vehicle killed: Vehicle %1 (TYPE: %2), CharacterID: %3, ObjectID: %4, ObjectUID: %5, Position: %6, Killer: %7 (UID: %8)", _object, (typeOf _object), _charID, _objID, _objUID, _worldSpace, _name, (getPlayerUID _killer)];
} else {
diag_log format["Vehicle killed: Vehicle %1 (TYPE: %2), CharacterID: %3, ObjectID: %4, ObjectUID: %5, Position: %6", _object, (typeOf _object), _charID, _objID, _objUID, _worldSpace];
};
};
};
 
_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];
} count _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;
if (_retry > 8) then {
PVDZE_vkc_Success = false;
(owner _player) publicVariableClient "PVDZE_vkc_Success";
};
} 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;;
};
};

 
So, I've also fixed the previous error in my logs. However, the option still isn't coming up when scrolling on the plotpole! And there's not a single error in the logs. :/
Link to comment
Share on other sites

Hi please help im getting this error where after I look at a plot pole that's NOT mine or im not added to none of the actions from the fn_selfactions show in the scroll menu anymore unless I relog or restart the server (also relogging xD) I tried looking for any out of place [s,s etc. but everything looked in order and in the correct format im pretty sure this is related to plot management since 1 I have it installed 2 only after I look at a plot pole this happens 3 my client side rpt says this after I look at a plot pole thats not mine .

arma 2oa client rpt

Error in expression <ds", []];
_fuid = [];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
>
  Error position: <select 0;
_fuid = _fuid + [_friendUID];
>
  Error select: Type Number, expected Array,Config entry
File mpmissions\__CUR_MP.Tavi\Skilled\actions\fn_selfActions.sqf, line 218

I know I cant access a plot pole unless I own or was added but its just the fact of raiding a base and incidentally looking at it.

 

And i also sometimes get something similar with door management if i click the scroll wheel actions that says manage door, but if I use the one under Unlock Door>Door Managment Main Dialog>Manage Button all my custom scroll wheel actions are fine.

Error in expression <"doorfriends",[]];
{
if ((_x  select 0) == (getPlayerUID player)) then{ _canOpen>
  Error position: <== (getPlayerUID player)) then{ _canOpen>
  Error ==: Type Array, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\initDoorManagement.sqf, line 13
Error in expression <"doorfriends",[]];
{
if ((_x  select 0) == (getPlayerUID player)) then{ _canOpen>
  Error position: <== (getPlayerUID player)) then{ _canOpen>
  Error Generic error in expression
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\initDoorManagement.sqf, line 13
Error in expression <ds", []];
_fuid = [];
{
_friendUID = _x select 0;
_fuid = _fuid + [_friendUID];
>
  Error position: <select 0;
_fuid = _fuid + [_friendUID];
>
  Error select: Type Number, expected Array,Config entry
File mpmissions\__CUR_MP.Tavi\Skilled\actions\fn_selfActions.sqf, line 218

",>

 

Heres my fn_selfactions.sqf

scriptName "Functions\misc\fn_selfActions.sqf";
/***********************************************************
	ADD ACTIONS FOR SELF
	- Function
	- [] call fnc_usec_selfActions;
************************************************************/
private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_isModularDoor","_ownerKeyName","_temp_keys_names","_hasAttached","_allowTow","_liftHeli","_found","_posL","_posC","_height","_liftHelis","_attached"];

if (DZE_ActionInProgress) exitWith {}; // Do not allow if any script is running.

_vehicle = vehicle player;
_isPZombie = player isKindOf "PZombie_VB";
_inVehicle = (_vehicle != player);

_onLadder =		(getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);

_nearLight = 	nearestObject [player,"LitObject"];
_canPickLight = false;
if (!isNull _nearLight) then {
	if (_nearLight distance player < 4) then {
		_canPickLight = isNull (_nearLight getVariable ["owner",objNull]);
	};
};

//Grab Flare
if (_canPickLight && !dayz_hasLight && !_isPZombie) then {
	if (s_player_grabflare < 0) then {
		_text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");
		s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];
		s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];
	};
} else {
	player removeAction s_player_grabflare;
	player removeAction s_player_removeflare;
	s_player_grabflare = -1;
	s_player_removeflare = -1;
};

if (DZE_HeliLift) then {
	_hasAttached = _vehicle getVariable["hasAttached",false];
	if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) < 30) && (speed _vehicle < 5) && (typeName _hasAttached == "OBJECT")) then {
		if (s_player_heli_detach < 0) then {
			dayz_myLiftVehicle = _vehicle;
			s_player_heli_detach = dayz_myLiftVehicle addAction ["Detach Vehicle","\z\addons\dayz_code\actions\player_heliDetach.sqf",[dayz_myLiftVehicle,_hasAttached],2,false,true,"",""];
		};
	} else {
		dayz_myLiftVehicle removeAction s_player_heli_detach;
		s_player_heli_detach = -1;
	};
};

if(DZE_HaloJump) then {
	if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {
		if (s_halo_action < 0) then {
			DZE_myHaloVehicle = _vehicle;
			s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];
		};
	} else {
		DZE_myHaloVehicle removeAction s_halo_action;
		s_halo_action = -1;
	};
};

if (!DZE_ForceNameTagsOff) then {
	if (s_player_showname < 0 && !_isPZombie) then {
		if (DZE_ForceNameTags) then {
			s_player_showname = 1;
			player setVariable["DZE_display_name",true,true];
		} else {
			s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];
			s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];
		};
	};
};

if(_isPZombie) then {
	if (s_player_callzombies < 0) then {
		s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];
	};
	if (DZE_PZATTACK) then {
		call pz_attack;
		DZE_PZATTACK = false;
	};
	if (s_player_pzombiesvision < 0) then {
		s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];
	};
	if (!isNull cursorTarget && (player distance cursorTarget < 3)) then {	//Has some kind of target
		_isAnimal = cursorTarget isKindOf "Animal";
		_isZombie = cursorTarget isKindOf "zZombie_base";
		_isHarvested = cursorTarget getVariable["meatHarvested",false];
		_isMan = cursorTarget isKindOf "Man";
		// Pzombie Gut human corpse || animal
		if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {
			if (s_player_pzombiesfeed < 0) then {
				s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];
			};
		} else {
			player removeAction s_player_pzombiesfeed;
			s_player_pzombiesfeed = -1;
		};
	} else {
		player removeAction s_player_pzombiesfeed;
		s_player_pzombiesfeed = -1;
	};
};

// Increase distance only if AIR || SHIP
_allowedDistance = 4;
_isAir = cursorTarget isKindOf "Air";
_isShip = cursorTarget isKindOf "Ship";
if(_isAir || _isShip) then {
	_allowedDistance = 8;
};

if (!isNull cursorTarget && !_inVehicle && !_isPZombie && (player distance cursorTarget < _allowedDistance) && _canDo) then {	//Has some kind of target

	// set cursortarget to variable
	_cursorTarget = cursorTarget;

	// get typeof cursortarget once
	_typeOfCursorTarget = typeOf _cursorTarget;

	// hintsilent _typeOfCursorTarget;

	_isVehicle = _cursorTarget isKindOf "AllVehicles";
	_isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];
	_isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;
	
	// get items && magazines only once
	_magazinesPlayer = magazines player;

	//boiled Water
	_hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;
	_hastinitem = false;
	{
		if (_x in _magazinesPlayer) then {
			_hastinitem = true;
		};
	} count boil_tin_cans;
	_hasFuelE = 	"ItemJerrycanEmpty" in _magazinesPlayer;
	_hasFuelBarrelE = 	"ItemFuelBarrelEmpty" in _magazinesPlayer;
	_hasHotwireKit = 	"ItemHotwireKit" in _magazinesPlayer;

	_itemsPlayer = items player;
	
	_temp_keys = [];
	_temp_keys_names = [];
	// find available keys
	_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
	{
		if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
			_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
			_ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
			_temp_keys_names set [_ownerKeyId,_ownerKeyName];
			_temp_keys set [count _temp_keys,str(_ownerKeyId)];
		};
	} count _itemsPlayer;

	_hasKnife = 	"ItemKnife" in _itemsPlayer;
	_hasToolbox = 	"ItemToolbox" in _itemsPlayer;

	_isMan = _cursorTarget isKindOf "Man";
	_traderType = _typeOfCursorTarget;
	_ownerID = _cursorTarget getVariable ["CharacterID","0"];
	_isAnimal = _cursorTarget isKindOf "Animal";
	_isDog =  (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");
	_isZombie = _cursorTarget isKindOf "zZombie_base";
	_isDestructable = _cursorTarget isKindOf "BuiltItems";
	_isWreck = _typeOfCursorTarget in DZE_isWreck;
	_isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;
	_isModular = _cursorTarget isKindOf "ModularItems";
	_isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];

	_isRemovable = _typeOfCursorTarget in DZE_isRemovable;
	_isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];

	_isTent = _cursorTarget isKindOf "TentStorage";
	
	_isAlive = alive _cursorTarget;
	
	_text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
	
	_rawmeat = meatraw;
	_hasRawMeat = false;
	{
		if (_x in _magazinesPlayer) then {
			_hasRawMeat = true;
		};
	} count _rawmeat; 
	
	_isFuel = false;
	if (_hasFuelE || _hasFuelBarrelE) then {
		{
			if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};
		} count dayz_fuelsources;
	};

	// diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));
	
	// logic vars
	_player_flipveh = false;
	_player_deleteBuild = false;
	_player_lockUnlock_crtl = false;

	 if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {
	 if (s_player_plotManagement < 0) then {
    _adminList = [
	"REMOVED FOR SECURITY" //Skilled
	
	             
				 
	 ]; // Add admins here if you admins to able to manage all plotpoles
    _owner = _cursorTarget getVariable ["CharacterID","0"];
    _friends = _cursorTarget getVariable ["plotfriends", []];
    _fuid = [];
    {
    _friendUID = _x select 0;
    _fuid = _fuid + [_friendUID];
    } forEach _friends;
    _allowed = [_owner];    
    _allowed = [_owner] + _adminList + _fuid;
    if(_owner == dayz_characterID || (getPlayerUID player) in _allowed)then{            
    s_player_plotManagement = player addAction ["<t color='#0059FF'>Manage Plot</t>", "Skilled\addons\plotManagement\initPlotManagement.sqf", [], 5, false];
    };
};

} else {
    player removeAction s_player_plotManagement;
    s_player_plotManagement = -1;
};

	// CURSOR TARGET ALIVE
	if(_isAlive) then {
		
		//Allow player to delete objects
		if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {
			if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
				_player_deleteBuild = true;
			};
		};

///Allow owners to delete modulars
if(_isModular) then {
        if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {
            _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
            _IsNearPlot = count (_findNearestPoles);
            _fuid  = [];
            _allowed = [];
            if(_IsNearPlot > 0)then{
                _thePlot = _findNearestPoles select 0;
                _owner =  _thePlot getVariable ["ownerPUID","010"];
                _friends = _thePlot getVariable ["plotfriends", []];
                {
                  _friendUID = _x select 0;
                  _fuid  =  _fuid  + [_friendUID];
                } forEach _friends;
                _allowed = [_owner];    
                _allowed = [_owner] +  _fuid;   
                if ( _playerUID in _allowed && _ownerID in _allowed ) then {  //If u want that the object also belongs to someone on the plotpole.
                    _player_deleteBuild = true;
                };                  
            }else{
                if(_ownerID == _playerUID)then{
                    _player_deleteBuild = true;
                };
            };                                        
        };
};
//Allow owners to delete modular doors without locks
if(_isModularDoor) then {
        if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {         
            _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
            _IsNearPlot = count (_findNearestPoles);
            _fuid  = [];
            _allowed = [];
            if(_IsNearPlot > 0)then{
                _thePlot = _findNearestPoles select 0;
                _owner =  _thePlot getVariable ["ownerPUID","010"];
                _friends = _thePlot getVariable ["plotfriends", []];
                {
                  _friendUID = _x select 0;
                  _fuid  =  _fuid  + [_friendUID];
                } forEach _friends;
                _allowed = [_owner];    
                _allowed = [_owner] +  _fuid;   
                if ( _playerUID in _allowed && _ownerID in _allowed) then { //  // If u want that the object also belongs to someone on the plotpole.
                    _player_deleteBuild = true;
                };                  
            }else{
                if(_ownerID == _playerUID)then{
                    _player_deleteBuild = true;
                };
            };                              
        };      
};

		// CURSOR TARGET VEHICLE
		if(_isVehicle) then {
			
			//flip vehicle small vehicles by your self && all other vehicles with help nearby
			if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {
				_playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);
				if(_isVehicletype || (_playersNear >= 2)) then {
					_player_flipveh = true;	
				};
			};


			if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {
				_player_lockUnlock_crtl = true;
			};

		};
	
	};

	if(_player_deleteBuild) then {
		if (s_player_deleteBuild < 0) then {
			s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "Skilled\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
		};
	} else {
		player removeAction s_player_deleteBuild;
		s_player_deleteBuild = -1;
	};
	
	if (DZE_HeliLift) then {
		_liftHeli = objNull;
		_found = false;
	
		_allowTow = false;
		if ((count (crew _cursorTarget)) == 0) then {
			{
				if(!_allowTow) then {
					_allowTow = _cursorTarget isKindOf _x;
				};
			} count DZE_HeliAllowToTow;
		};

		//diag_log format["CREW: %1 ALLOW: %2",(count (crew _cursorTarget)),_allowTow];

		if (_allowTow) then {
			_liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15];
			{
				if(!_found) then {
					_posL = [_x] call FNC_getPos;
					_posC = [_cursorTarget] call FNC_getPos;
					_height = (_posL select 2) - (_posC select 2);
					_hasAttached = _x getVariable["hasAttached",false];
					if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {
						if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {
							_liftHeli = _x;
							_found = true;
						};
					};
				};
			} count _liftHelis;
		};

		//diag_log format["HELI: %1 TARGET: %2",_found,_cursorTarget];

		_attached = _cursorTarget getVariable["attached",false];
		if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {
			if (s_player_heli_lift < 0) then {
				s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];
			};
		} else {
			player removeAction s_player_heli_lift;
			s_player_heli_lift = -1;
		};
	};
	
	// Allow Owner to lock && unlock vehicle  
	if(_player_lockUnlock_crtl) then {
		if (s_player_lockUnlock_crtl < 0) then {
			_hasKey = _ownerID in _temp_keys;
			_oldOwner = (_ownerID == dayz_playerUID);
			if(locked _cursorTarget) then {
				if(_hasKey || _oldOwner) then {
					_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];
					s_player_lockunlock set [count s_player_lockunlock,_Unlock];
					s_player_lockUnlock_crtl = 1;
				} else {
					if(_hasHotwireKit) then {
						_Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];
					} else {
						_Unlock = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];
					};
					s_player_lockunlock set [count s_player_lockunlock,_Unlock];
					s_player_lockUnlock_crtl = 1;
				};
			} else {
				if(_hasKey || _oldOwner) then {
					_lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];
					s_player_lockunlock set [count s_player_lockunlock,_lock];
					s_player_lockUnlock_crtl = 1;

		            if (_typeOfCursorTarget in ColourVehicles) then { //Custom Paint Vehicle Start
		            private ["_paint"];
		            _paint = player addAction ["Paint Vehicle", "Skilled\addons\Paint\player_paint_init.sqf",_cursorTarget, 2, true, true, "", ""];
		            s_player_lockunlock set [count s_player_lockunlock,_paint];
	                }; //Custom Paint Vehicle End

					
				};
			};
		};
		 
	} else {
		{player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
		s_player_lockUnlock_crtl = -1;
	};

	if(DZE_AllowForceSave) then {
		//Allow player to force save
		if((_isVehicle || _isTent) && !_isMan) then {
			if (s_player_forceSave < 0) then {
				s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];
			};
		} else {
			player removeAction s_player_forceSave;
			s_player_forceSave = -1;
		};
	};

	
	
	If(DZE_AllowCargoCheck) then {
		if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {
			if (s_player_checkGear < 0) then {
				s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];
			};
		} else {
			player removeAction s_player_checkGear;
			s_player_checkGear = -1;
		};
	};
	
	
	//flip vehicle small vehicles by your self && all other vehicles with help nearby
	if(_player_flipveh) then {
		if (s_player_flipveh  < 0) then {
			s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];		
		};
	} else {
		player removeAction s_player_flipveh;
		s_player_flipveh = -1;
	}; 
	
	//Allow player to fill jerrycan
	if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {
		if (s_player_fillfuel < 0) then {
			s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];
		};
	} else {
		player removeAction s_player_fillfuel;
		s_player_fillfuel = -1;
	};
	
	// logic vars for addactions
	_player_butcher = false;
	_player_studybody = false;
	_player_SurrenderedGear = false;

	// CURSOR TARGET NOT ALIVE
	if (!_isAlive) then {

		// Gut animal/zed
		if((_isAnimal || _isZombie) && _hasKnife) then {
			_isHarvested = _cursorTarget getVariable["meatHarvested",false];
			if (!_isHarvested) then {
				_player_butcher = true;
			};
		};

		// Study body
		if (_isMan && !_isZombie && !_isAnimal) then {
			_player_studybody = true;
		}
	} else {
		// unit alive

		// gear access on surrendered player
		if(_isMan && !_isZombie && !_isAnimal) then {
			_isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];
			if (_isSurrendered) then {
				_player_SurrenderedGear = true;
			};
		};
	};


	// Human Gut animal || zombie
	if (_player_butcher) then {
		if (s_player_butcher < 0) then {
			if(_isZombie) then {
				s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];
			} else {
				s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];
			};
		};
	} else {
		player removeAction s_player_butcher;
		s_player_butcher = -1;
	};
	
	//FOR COINS
if (_player_studybody) then {
	if (s_player_studybody < 0) then {
		s_player_studybody = player addAction [("<t color=""#FF0000"">"+("Check Wallet/Identify") + "</t>"), "Skilled\coins\actions\check_wallet.sqf",_cursorTarget, 0, false, true, "",""];
	};
} else {
	player removeAction s_player_studybody;
	s_player_studybody = -1;
};
	
	// logic vars
	_player_cook = false;
	_player_boil = false;

	// CURSOR TARGET IS FIRE
	if (inflamed _cursorTarget) then {
		
		//Fireplace Actions check
		if (_hasRawMeat) then {
			_player_cook = true;	
		};
		
		// Boil water
		if (_hasbottleitem && _hastinitem) then {
			_player_boil = true;
		};
	};

	if (_player_SurrenderedGear) then {
		if (s_player_SurrenderedGear < 0) then {
			s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];
		};
	} else {
		player removeAction s_player_SurrenderedGear;
		s_player_SurrenderedGear = -1;
	};

	//Fireplace Actions check
	if (_player_cook) then {
		if (s_player_cook < 0) then {
			s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];
		};
	} else {
		player removeAction s_player_cook;
		s_player_cook = -1;
	};
	
	// Boil water
	if (_player_boil) then {
		if (s_player_boil < 0) then {
			s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];
		};
	} else {
		player removeAction s_player_boil;
		s_player_boil = -1;
	};
	
	if(_cursorTarget == dayz_hasFire) then {
		if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
			s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
		};
	} else {
		player removeAction s_player_fireout;
		s_player_fireout = -1;
	};
	
	//Packing my tent
	if(_isTent && (player distance _cursorTarget < 3)) then {
		if (_ownerID == dayz_characterID) then {
			if (s_player_packtent < 0) then {
				s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
			};
		} else {
			if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
				if (s_player_packtent < 0) then {
					s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
				};
			};
		};
	} else {
		player removeAction s_player_packtent;
		s_player_packtent = -1;
	};

/*Door Management Start*/
if((_typeOfCursorTarget in DZE_DoorsLocked)) then {
	if (s_player_manageDoor < 0) then {		 
     s_player_manageDoor = player addAction ["<t color='#0059FF'>Manage Door Scanner</t>", "Skilled\addons\doorManagement\initDoorManagement.sqf", _cursorTarget, 5, false];
	};
} else {
		player removeAction s_player_manageDoor;
		s_player_manageDoor = -1;
};	
/*Door Management End*/

	//Allow owner to unlock vault
	if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
		if (s_player_unlockvault < 0) then {
			if(_typeOfCursorTarget in DZE_LockedStorage) then {
				if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
				} else {
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
				};
				s_player_unlockvault = 1;
			} else {
				if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
					_combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
					s_player_unlockvault = 1;
				};
			};
		};
	} else {
		{player removeAction _x} count s_player_combi;s_player_combi = [];
		s_player_unlockvault = -1;
	};
	
	//COINS
		if(_typeOfCursorTarget in ZSC_MoneyStorage && (player distance _cursorTarget < 5)) then {
		if (s_bank_dialog < 0) then {
				s_bank_dialog = player addAction ["Money Storage", "Skilled\coins\actions\bank_dialog.sqf",_cursorTarget, 3, true, true, "", ""];	
		};
	} else {
     	player removeAction s_bank_dialog;
		s_bank_dialog = -1;
	};

	// cars 
	if( _isVehicle && !_isMan &&_isAlive && !_isMan && !locked _cursorTarget && !(_cursorTarget isKindOf "Bicycle") && (player distance _cursorTarget < 5)) then {		
		if (s_bank_dialog2 < 0) then {
			s_bank_dialog2 = player addAction ["Money Storage", "Skilled\coins\actions\bank_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
		};			
	} else {		
		player removeAction s_bank_dialog2;
		s_bank_dialog2 = -1;
	};
	//COINS END

	//Allow owner to pack vault
	if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {

		if (s_player_lockvault < 0) then {
			if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
				s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];
			};
		};
		if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
			s_player_packvault = player addAction [format["<t color='#ff0000'>%1</t>",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];
		};
	} else {
		player removeAction s_player_packvault;
		s_player_packvault = -1;
		player removeAction s_player_lockvault;
		s_player_lockvault = -1;
	};

	

    //Player Deaths
	if(_typeOfCursorTarget == "Info_Board_EP1") then {
		if (s_player_information < 0) then {
			s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];
		};
	} else {
		player removeAction s_player_information;
		s_player_information = -1;
	};
	

	if (_isMan and _isAlive and !_isZombie and !_isAnimal and !(_traderType in serverTraders)) then { //COINS START
	if (s_givemoney_dialog < 0) then {
		s_givemoney_dialog = player addAction [format["Give Money to %1", (name _cursorTarget)], "Skilled\coins\actions\give_player_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
	};
} else {
	player removeAction s_givemoney_dialog;
	s_givemoney_dialog = -1;
};

	
	//Fuel Pump
	if(_typeOfCursorTarget in dayz_fuelpumparray) then {	
		if (s_player_fuelauto < 0) then {
			
			// check if Generator_DZ is running within 30 meters
			_findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];
			_findNearestGen = [];
			{
				if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {
					_findNearestGen set [(count _findNearestGen),_x];
				};
			} count _findNearestGens;
			_IsNearRunningGen = count (_findNearestGen);
			
			// show that pump needs power if no generator nearby.
			if(_IsNearRunningGen > 0) then {
				s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];
			} else {
				s_player_fuelauto = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
			};
		};
	} else {
		player removeAction s_player_fuelauto;
		s_player_fuelauto = -1;
	};

	//Fuel Pump on truck
	if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {	
		if (s_player_fuelauto2 < 0) then {
			// show that fuel truck pump needs power.
			if(isEngineOn _cursorTarget) then {
				s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];
			} else {
				s_player_fuelauto2 = player addAction [format["<t color='#ff0000'>%1</t>",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];
			};
		};
	} else {
		player removeAction s_player_fuelauto2;
		s_player_fuelauto2 = -1;
	};

	// inplace upgrade tool
	if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {
		if ((s_player_lastTarget select 0) != _cursorTarget) then {
			if (s_player_upgrade_build > 0) then {
				player removeAction s_player_upgrade_build;
				s_player_upgrade_build = -1;
			};
		};
		if (s_player_upgrade_build < 0) then {
			// s_player_lastTarget = _cursorTarget;
			s_player_lastTarget set [0,_cursorTarget];
			s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "Skilled\actions\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""]; //CUSTOM PLOT MANAGEMENT
		};
	} else {
		player removeAction s_player_upgrade_build;
		s_player_upgrade_build = -1;
	};
	
	// downgrade system
	if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
		if ((s_player_lastTarget select 1) != _cursorTarget) then {
			if (s_player_downgrade_build > 0) then {	
				player removeAction s_player_downgrade_build;
				s_player_downgrade_build = -1;
			};
		};

		if (s_player_downgrade_build < 0) then {
			s_player_lastTarget set [1,_cursorTarget];
			s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "Skilled\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""]; //CUSTOM PLOT MANAGEMENT
		};
	} else {
		player removeAction s_player_downgrade_build;
		s_player_downgrade_build = -1;
	};

	// inplace maintenance tool
	if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {
		if ((s_player_lastTarget select 2) != _cursorTarget) then {
			if (s_player_maint_build > 0) then {	
				player removeAction s_player_maint_build;
				s_player_maint_build = -1;
			};
		};

		if (s_player_maint_build < 0) then {
			s_player_lastTarget set [2,_cursorTarget];
			s_player_maint_build = player addAction [format[localize "STR_EPOCH_ACTIONS_MAINTAIN",_text], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true, "",""];
		};
	} else {
		player removeAction s_player_maint_build;
		s_player_maint_build = -1;
	};


	//Start Generator
	if(_cursorTarget isKindOf "Generator_DZ") then {
		if (s_player_fillgen < 0) then {
			
			// check if not running 
			if((_cursorTarget getVariable ["GeneratorRunning", false])) then {
				s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];				
			} else {
			// check if not filled && player has jerry.
				if((_cursorTarget getVariable ["GeneratorFilled", false])) then {
					s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
				} else {
					if("ItemJerrycan" in _magazinesPlayer) then {
						s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];
					};
				};
			};
		};
	} else {
		player removeAction s_player_fillgen;
		s_player_fillgen = -1;
	};

	//Towing with tow truck
	/*
	if(_typeOfCursorTarget == "TOW_DZE") then {
		if (s_player_towing < 0) then {
			if(!(_cursorTarget getVariable ["DZEinTow", false])) then {
				s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];				
			} else {
				s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];				
			};
		};
	} else {
		player removeAction s_player_towing;
		s_player_towing = -1;
	};
	*/


    //Sleep
	if(_isTent && _ownerID == dayz_characterID) then {
		if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {
			s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];
		};
	} else {
		player removeAction s_player_sleep;
		s_player_sleep = -1;
	};
	
	//Repairing Vehicles
	if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {
		if (s_player_repair_crtl < 0) then {
			dayz_myCursorTarget = _cursorTarget;
			_menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
			_menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
			s_player_repairActions set [count s_player_repairActions,_menu];
			s_player_repairActions set [count s_player_repairActions,_menu1];
			s_player_repair_crtl = 1;
		} else {
			{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
			s_player_repair_crtl = -1;
		};
	};
	
	//Pack Vehicles
	if (_typeOfCursorTarget in EVDVehicleArray and _hasToolbox and !(locked _cursorTarget) and (damage _cursorTarget < 1)) then {
		if (s_player_packvehicle < 0) then {
			s_player_packvehicle = player addAction ["Pack Vehicle", "Skilled\addons\deploy\pack.sqf",_cursorTarget, 0, false, true, "",""];
		};
	} else {
		player removeAction s_player_packvehicle;
		s_player_packvehicle = -1;
	};
	
	// All Traders
	if (_isMan && !_isPZombie && _traderType in serverTraders) then {
		
		if (s_player_parts_crtl < 0) then {

			// get humanity
			_humanity = player getVariable ["humanity",0];
			_traderMenu = call compile format["menu_%1;",_traderType];

			// diag_log ("TRADER = " + str(_traderMenu));
			
			_low_high = "low";
			_humanity_logic = false;
			if((_traderMenu select 2) == "friendly") then {
				_humanity_logic = (_humanity < -5000);
			};
			if((_traderMenu select 2) == "hostile") then {
				_low_high = "high";
				_humanity_logic = (_humanity > -5000);
			};
			if((_traderMenu select 2) == "hero") then {
				_humanity_logic = (_humanity < 5000);
			};
			if(_humanity_logic) then {
				_cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
				s_player_parts set [count s_player_parts,_cancel];
			} else {
				
				// Static Menu
				{
					//diag_log format["DEBUG TRADER: %1", _x];
					_buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""];
					s_player_parts set [count s_player_parts,_buy];
				
				} count (_traderMenu select 1);
				// Database menu
				LastTraderMenu = (_traderMenu select 0);
				_buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];
				s_player_parts set [count s_player_parts,_buy];

			};
			s_player_parts_crtl = 1;
			
		};
	} else {
		{player removeAction _x} count s_player_parts;s_player_parts = [];
		s_player_parts_crtl = -1;
	};

	
	if(dayz_tameDogs) then {
		
		//Dog
		if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {
			if (s_player_tamedog < 0) then {
				s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];
			};
		} else {
			player removeAction s_player_tamedog;
			s_player_tamedog = -1;
		};
		if (_isDog && _ownerID == dayz_characterID && _isAlive) then {
			_dogHandle = player getVariable ["dogID", 0];
			if (s_player_feeddog < 0 && _hasRawMeat) then {
				s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];
			};
			if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {
				s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];
			};
			if (s_player_staydog < 0) then {
				_lieDown = _dogHandle getFSMVariable "_actionLieDown";
				if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };
				s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];
			};
			if (s_player_trackdog < 0) then {
				s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];
			};
			if (s_player_barkdog < 0) then {
				s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];
			};
			if (s_player_warndog < 0) then {
				_warn = _dogHandle getFSMVariable "_watchDog";
				if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };
				s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];		
			};
			if (s_player_followdog < 0) then {
				s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];
			};
		} else {
			player removeAction s_player_feeddog;
			s_player_feeddog = -1;
			player removeAction s_player_waterdog;
			s_player_waterdog = -1;
			player removeAction s_player_staydog;
			s_player_staydog = -1;
			player removeAction s_player_trackdog;
			s_player_trackdog = -1;
			player removeAction s_player_barkdog;
			s_player_barkdog = -1;
			player removeAction s_player_warndog;
			s_player_warndog = -1;
			player removeAction s_player_followdog;
			s_player_followdog = -1;
			//Door Management Addon Custom
			player removeAction s_player_manageDoor;
            s_player_manageDoor = -1;
		};
	};

} else {
	//Engineering
	player removeAction s_player_plotManagement; //Plot Management
    s_player_plotManagement = -1; //Plot Management

	{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
	s_player_repair_crtl = -1;

	{player removeAction _x} count s_player_combi;s_player_combi = [];
		
	dayz_myCursorTarget = objNull;
	s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];

	{player removeAction _x} count s_player_parts;s_player_parts = [];
	s_player_parts_crtl = -1;

	{player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];
	s_player_lockUnlock_crtl = -1;

	player removeAction s_player_checkGear;
	s_player_checkGear = -1;

	player removeAction s_player_SurrenderedGear;
	s_player_SurrenderedGear = -1;

	//Others
	player removeAction s_player_forceSave;
	s_player_forceSave = -1;
	player removeAction s_player_flipveh;
	s_player_flipveh = -1;
	player removeAction s_player_sleep;
	s_player_sleep = -1;
	player removeAction s_player_deleteBuild;
	s_player_deleteBuild = -1;
	player removeAction s_player_butcher;
	s_player_butcher = -1;
	player removeAction s_player_cook;
	s_player_cook = -1;
	player removeAction s_player_boil;
	s_player_boil = -1;
	player removeAction s_player_fireout;
	s_player_fireout = -1;
	player removeAction s_player_packtent;
	s_player_packtent = -1;
	player removeAction s_player_fillfuel;
	s_player_fillfuel = -1;
	player removeAction s_player_studybody;
	s_player_studybody = -1;
	//Dog
	player removeAction s_player_tamedog;
	s_player_tamedog = -1;
	player removeAction s_player_feeddog;
	s_player_feeddog = -1;
	player removeAction s_player_waterdog;
	s_player_waterdog = -1;
	player removeAction s_player_staydog;
	s_player_staydog = -1;
	player removeAction s_player_trackdog;
	s_player_trackdog = -1;
	player removeAction s_player_barkdog;
	s_player_barkdog = -1;
	player removeAction s_player_warndog;
	s_player_warndog = -1;
	player removeAction s_player_followdog;
	s_player_followdog = -1;
    
    // vault
	player removeAction s_player_unlockvault;
	s_player_unlockvault = -1;
	player removeAction s_player_packvault;
	s_player_packvault = -1;
	player removeAction s_player_lockvault;
	s_player_lockvault = -1;

	player removeAction s_player_information;
	s_player_information = -1;
	player removeAction s_player_fillgen;
	s_player_fillgen = -1;
	player removeAction s_player_upgrade_build;
	s_player_upgrade_build = -1;
	player removeAction s_player_maint_build;
	s_player_maint_build = -1;
	player removeAction s_player_downgrade_build;
	s_player_downgrade_build = -1;
	player removeAction s_givemoney_dialog;	//COINS START
    s_givemoney_dialog = -1;
    player removeAction s_bank_dialog;
    s_bank_dialog = -1;
    player removeAction s_bank_dialog2;
    s_bank_dialog2 = -1; 	//COINS END
	player removeAction s_player_towing;
	s_player_towing = -1;
	player removeAction s_player_fuelauto;
	s_player_fuelauto = -1;
	player removeAction s_player_fuelauto2;
	s_player_fuelauto2 = -1;
};


//Dog actions on player self
_dogHandle = player getVariable ["dogID", 0];
if (_dogHandle > 0) then {
	_dog = _dogHandle getFSMVariable "_dog";
	_ownerID = "0";
	if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };
	if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {
		if (s_player_movedog < 0) then {
			s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];
		};
		if (s_player_speeddog < 0) then {
			_text = (localize "str_epoch_player_249");
			_speed = 0;
			if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };
			s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID", 0],_speed], 0, false, true, "", ""];
		};
		if (s_player_calldog < 0) then {
			s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID", 0], true], 2, false, true, "", ""];
		};
	};
} else {
	player removeAction s_player_movedog;		
	s_player_movedog =		-1;
	player removeAction s_player_speeddog;
	s_player_speeddog =		-1;
	player removeAction s_player_calldog;
	s_player_calldog = 		-1;
};

 

 

door management error client log(when trying to manage a door you dont own)

Error in expression <"doorfriends",[]];
{
if ((_x  select 0) == (getPlayerUID player)) then{ _canOpen>
  Error position: <== (getPlayerUID player)) then{ _canOpen>
  Error ==: Type Array, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\initDoorManagement.sqf, line 13
Error in expression <"doorfriends",[]];
{
if ((_x  select 0) == (getPlayerUID player)) then{ _canOpen>
  Error position: <== (getPlayerUID player)) then{ _canOpen>
  Error Generic error in expression
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\initDoorManagement.sqf, line 13
Error in expression <"doorfriends",[]];
{
if ((_x  select 0) == (getPlayerUID player)) then{ _canOpen>
  Error position: <== (getPlayerUID player)) then{ _canOpen>
  Error ==: Type Array, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\initDoorManagement.sqf, line 13
Error in expression <"doorfriends",[]];
{
if ((_x  select 0) == (getPlayerUID player)) then{ _canOpen>
  Error position: <== (getPlayerUID player)) then{ _canOpen>
  Error Generic error in expression
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\initDoorManagement.sqf, line 13
Error in expression <;
};
_allowed = [];
{
_friendUID = _x select 0;
_allowed  =  _allowed  + [_fri>
  Error position: <select 0;
_allowed  =  _allowed  + [_fri>
  Error select: Type Number, expected Array,Config entry
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\player_unlockDoor.sqf, line 24
Error in expression <;
};
_allowed = [];
{
_friendUID = _x select 0;
_allowed  =  _allowed  + [_fri>
  Error position: <select 0;
_allowed  =  _allowed  + [_fri>
  Error Generic error in expression
File mpmissions\__CUR_MP.Tavi\Skilled\addons\doorManagement\player_unlockDoor.sqf, line 24
"CinderWallDoorLocked_DZ, WorldSpace: [264.778,[8425.19,20814.1,0.00325012]], @084047"
"LockCode: 551, objID: 2250, objUID: 0, lastUpdate: 0s ago"
Error in expression <ds",[]];
_fuid  = [];
{
_friendUID = _x select 0;
_fuid  =  _fuid  + [_friendUID>
  Error position: <select 0;
_fuid  =  _fuid  + [_friendUID>
  Error select: Type Number, expected Array,Config entry
File mpmissions\__CUR_MP.Tavi\Skilled\actions\player_buildingDowngrade.sqf, line 50

The main error im worried about is the plot management/scroll wheel one.
Also did more testing and it seems like even if you own the plot pole after a restart you cant access it (same error pops up when trying) but you can still build in its radius which is weird because its like its saving my id to the plotpole but at the same time not keeping me on the friendlys list but for some reason people I add underplot friends can still build after restart but still not access it, it probaly seems like to anyone ready this I made sqf newbie mistake and forgot to make the edits server side etc but I didnt forget ive also checked the edits server side and made sure the code was updated (i can post any files needed) door management is doing the same thing but if you just log out and back in you can still access the manage on plot poles and doors just not after the server's 1st restart since you placed it.
 
Im very lost here the only clue I have is it seems like plotfriends and doorfriends either arent defined or theres a mistake in the plotfriends and doorfriends variables.
Any help is much appreciated.
Thanks
Link to comment
Share on other sites

Ok I think Ive found the problem from the testing ive done, ive noticed once you place a plot pole and/or door you can add yourself(actually my names already on doorfriends when i manage it) to it but it doesnt put my player uid and or my name in the entry in the database on the most recently added plot pole and door so I believe my problem is something to do with it publishing the objects and my uid to the database hence also why when you die and respawn you cant access it or when the server restarts the builder of the plot pole can still build but not manage it.

Here is my server.rpt from the time I placed my plot pole and cinder wall to a few minutes after.

21:38:28 taviana\budovy\veznica_zabradli.p3d: house, config class missing
21:38:28 taviana\budovy\veznica_zabradli.p3d: house, config class missing
21:38:58 "CLEANUP: Deleted 1 Animals out of 1"
21:38:58 "Purging player: 2cf22040# 732539: proxy_man.p3d"
21:38:58 "CLEANUP: Deleted 1 players && 0 zombies out of 4 dead"
21:38:59 "DELETE: B 1-1-C:1 ([BSA]Skilled[PITY]) REMOTE Deleted by UID: 1021521818880210"
21:38:59 "PUBLISH: B 1-1-C:1 ([BSA]Skilled[PITY]) REMOTE upgraded CinderWallDoorSmall_DZ with ID "1021521818880210""
21:39:05 "TIME SYNC: Local Time set to [2013,8,3,11,39]"
21:39:23 "DELETE: B 1-1-C:1 ([BSA]Skilled[PITY]) REMOTE Deleted by UID: 1021521818880210"
21:39:23 "PUBLISH: B 1-1-C:1 ([BSA]Skilled[PITY]) REMOTE upgraded CinderWallDoorSmallLocked_DZ with ID "1021521818880210""

Here is my client rpt from the time I placed it to a few minutes after.

Error: Vertex shader ID out of limits
Client: Network message 159f8 (update info 41a0cfd8) is pending
Client: Network message 15ac3 (update info 41a0cfd8) is pending
Client: Network message 15b58 (update info 41a0cfd8) is pending
Client: Network message 15bf5 (update info 41a0cfd8) is pending
//This is after I built my plot pole and opened the manage dialog (before restart) think its just because I made a error when changing the maintain currency to Zupa SC3.0
Error in expression < format["Price to maintain: %1 %2" , 0, cashMoney];

_ctrl ctrlSetText   _result>
  Error position: <cashMoney];

_ctrl ctrlSetText   _result>
  Error Undefined variable in expression: cashmoney
File mpmissions\__CUR_MP.Tavi\Skilled\addons\plotManagement\maintain_area.sqf, line 34
//Removed bunch of junk spam errors (Vertex ID Limit)
//Closed it and clicked manage again since I saw that error in my client because I had -showscripterrors on
Error in expression < format["Price to maintain: %1 %2" , 0, cashMoney];

_ctrl ctrlSetText   _result>
  Error position: <cashMoney];

_ctrl ctrlSetText   _result>
  Error Undefined variable in expression: cashmoney
File mpmissions\__CUR_MP.Tavi\Skilled\addons\plotManagement\maintain_area.sqf, line 34
//Removed a bunch of config class missing errors 
Ref to nonnetwork object 31780f00# 735859: sphere10cm_ep1.p3d
Ref to nonnetwork object 31780800# 735860: sphere10cm_ep1.p3d
Ref to nonnetwork object 31781600# 735861: sphere10cm_ep1.p3d
Ref to nonnetwork object 458e4f00# 735862: sphere10cm_ep1.p3d
Ref to nonnetwork object 22907200# 735863: sphere10cm_ep1.p3d
Ref to nonnetwork object 22905d00# 735864: sphere10cm_ep1.p3d
Ref to nonnetwork object 22907900# 735865: sphere10cm_ep1.p3d
Ref to nonnetwork object 458e4100# 735866: sphere10cm_ep1.p3d
Ref to nonnetwork object 458e5600# 735867: sphere10cm_ep1.p3d
//This is when I upgraded my door with a combo lock
Error in expression <VDZE_veh_Update";
PVDZE_veh_Update call server_updateObject;


} else {

{player>
  Error position: <server_updateObject;


} else {

{player>
  Error Undefined variable in expression: server_updateobject
File mpmissions\__CUR_MP.Tavi\Skilled\actions\player_upgrade.sqf, line 202
Error in expression <VDZE_veh_Update";
PVDZE_veh_Update call server_updateObject;


} else {

{player>
  Error position: <server_updateObject;


} else {

{player>
  Error Undefined variable in expression: server_updateobject
File mpmissions\__CUR_MP.Tavi\Skilled\actions\player_upgrade.sqf, line 202
ca\misc\piskoviste.p3d: house, config class missing
ca\misc\houpacka.p3d: house, config class missing
ca\misc\houpacka.p3d: house, config class missing
taviana\budovy\huge_block_geo.p3d: house, config class missing
taviana\budovy\rov_nam.p3d: house, config class missing
ca\misc\piskoviste.p3d: house, config class m

But I didnt see anything in my rpt logs about a plot pole.

I looked over the instructions again but it didn't fix it, and I do have all the correct edits for server update object and server monitor and im not getting any errors in those so I don't suspect its there (but i can post them anyways if needed) also because I have vehicle paint & build vector edits in server_updateobject and monitor and it works fine and saves over all restarts.

 

If someone could please look at my files that would be much appreciated.

 

My player_upgrade.sqf on thats pointed too from fnselfactions (is this supposed to be called in the compiles.sqf also because if so that might be my problem)

/*
DayZ Base Building Upgrades
Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_newclassname","_requirements","_obj","_upgrade","_lockable","_combination_1","_combination_2","_combination_3","_combination","_objectCharacterID","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_distance","_needText","_findNearestPoles","_findNearestPole","_IsNearPlot"];
 
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_52") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
 
player removeAction s_player_upgrade_build;
s_player_upgrade_build = 1;
 
 
_distance = 30;
_needText = localize "str_epoch_player_246";
 
// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];
 
{
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} count _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
_canBuildOnPlot = false;
 
if(_IsNearPlot == 0) then {
_canBuildOnPlot = true;
} else {
 
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
 
// Find owner 
_ownerID = _nearestPole getVariable["CharacterID","0"];
 
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
 
// check if friendly to owner
if(dayz_characterID == _ownerID) then {
_canBuildOnPlot = true;
} else {
/*Plot Management Start*/
_friendlies = _nearestPole getVariable ["plotfriends",[]];
_fuid  = [];
{
      _friendUID = _x select 0;
      _fuid  =  _fuid  + [_friendUID];
} forEach _friendlies;
_builder  = getPlayerUID player;
// check if friendly to owner
if(_builder in _fuid) then {
    _canBuildOnPlot = true;
};
/*Plot Management End*/
/* Replaced By Plot Management ** Edit.
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
if(_ownerID in _friendlies) then {
_canBuildOnPlot = true;
};
*/
};
};
 
// exit if not allowed due to plot pole
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_157"),_needText,_distance] , "PLAIN DOWN"]; };
 
// get cursortarget from addaction
_obj = _this select 3;
 
// Find objectID
_objectID = _obj getVariable ["ObjectID","0"];
 
// Find objectUID
_objectUID = _obj getVariable ["ObjectUID","0"];
 
if(_objectID == "0" && _objectUID == "0") exitWith {DZE_ActionInProgress = false; s_player_upgrade_build = -1; cutText [(localize "str_epoch_player_50"), "PLAIN DOWN"];};
 
// Get classname
_classname = typeOf _obj;
 
// Find display name
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
 
// Find next upgrade
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "upgradeBuilding");
 
if ((count _upgrade) > 0) then {
 
_newclassname = _upgrade select 0;
 
_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {
_lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");
};
 
_requirements = _upgrade select 1;
 
_missingQty = 0;
_missing = "";
 
_proceed = true;
{
_itemIn = _x select 0;
_countIn = _x select 1;
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
} forEach _requirements;
 
if (_proceed) then {
[1,1] call dayz_HungerThirst;
player playActionNow "Medic";
[player,20,true,(getPosATL player)] spawn player_alertZombies;
 
_temp_removed_array = [];
_removed_total = 0;
_tobe_removed_total = 0;
 
{
_removed = 0;
_itemIn = _x select 0;
_countIn = _x select 1;
// diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
_tobe_removed_total = _tobe_removed_total + _countIn;
 
{
if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
_num_removed = ([player,_x] call BIS_fnc_invRemove);
_removed = _removed + _num_removed;
_removed_total = _removed_total + _num_removed;
if(_num_removed >= 1) then {
_temp_removed_array set [count _temp_removed_array,_x];
};
};
 
} forEach magazines player;
 
} forEach _requirements;
 
// all parts removed proceed
if (_tobe_removed_total == _removed_total) then {
 
// Get position
_location = _obj getVariable["OEMPos",(getposATL _obj)];
 
// Get direction
_dir = getDir _obj;
 
//CUSTOM VECTOR
_vector = [(vectorDir _obj),(vectorUp _obj)];
 
// Current charID
_objectCharacterID = _obj getVariable ["CharacterID","0"];
 
_classname = _newclassname;
 
// Create new object 
_object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];
 
// Set direction
_object setDir _dir;
 
//CUSTOM VECTOR
_object setVectorDirAndUp _vector;
 
// Set location
_object setPosATL _location;
 
if (_lockable == 3) then {
 
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
_combination_3 = floor(random 10);
_combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
 
_objectCharacterID = _combination;
 
cutText [format[(localize "str_epoch_player_158"),_combination,_text], "PLAIN DOWN", 5];
} else {
cutText [format[(localize "str_epoch_player_159"),_text], "PLAIN DOWN", 5];
};
 
PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_vector],_classname,_obj,player];
publicVariableServer "PVDZE_obj_Swap";
 
player reveal _object;
 
/*Door Management Start*/
_friendUID = getPlayerUID player;
_friendName = name  player;
_friends = [[_friendUID,_friendName]] ; 
 
 
_object setVariable ["doorfriends", _friends, true];
PVDZE_veh_Update = [_object,"gear"];
publicVariableServer "PVDZE_veh_Update";
PVDZE_veh_Update call server_updateObject;
/*Door Management End*/
 
} else {
 
{player addMagazine _x;} count _temp_removed_array;
cutText [format[(localize "str_epoch_player_145"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
 
};
} else {
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
cutText [format[(localize "str_epoch_player_146"),_missingQty, _textMissing], "PLAIN DOWN"];
};
 
} else {
cutText [(localize "str_epoch_player_82"), "PLAIN DOWN"];
};
 
DZE_ActionInProgress = false;
s_player_upgrade_build = -1;

 
 
My SnapPro&Vector building player_build

/*
DayZ Base Building
Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_helperColor","_objectHelper","_objectHelperDir","_objectHelperPos","_canDo", "_pos", "_cnt",
"_location","_dir","_classname","_item","_hasrequireditem","_missing","_hastoolweapon","_cancel","_reason","_started","_finished","_animState","_isMedic","_dis","_sfx","_hasbuilditem","_tmpbuilt","_onLadder","_isWater","_require","_text","_offset","_IsNearPlot","_isOk","_location1","_location2","_counter","_limit","_proceed","_num_removed","_position","_object","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_findNearestPoles","_findNearestPole","_distance","_classnametmp","_ghost","_isPole","_needText","_lockable","_zheightchanged","_rotate","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_combinationDisplay","_zheightdirection","_abort","_isNear","_need","_needNear","_vehicle","_inVehicle","_requireplot","_objHDiff","_isLandFireDZ","_isTankTrap"];
 
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
 
//snap vars -- temporary fix for errors so variables.sqf can be skipped
if (isNil "snapProVariables") then {
if (isNil "DZE_snapExtraRange") then {
DZE_snapExtraRange = 0;
};
if (isNil "DZE_checkNearbyRadius") then {
DZE_checkNearbyRadius = 30;
};
s_player_toggleSnap = -1;
s_player_toggleSnapSelect = -1;
s_player_toggleSnapSelectPoint=[];
snapActions = -1;
snapGizmos = [];
snapGizmosNearby = [];
snapProVariables = true; // will skip this statement from now on.
};
// snap vars
 
// disallow building if too many objects are found within (30m by default) add DZE_checkNearbyRadius = 30; to your init.sqf to change
//Custom lines 33 34 and 36 for Plot Management zupa
_pos = [player] call FNC_GetPos;
_count1 = count (_pos nearObjects ["All",DZE_checkNearbyRadius]); 
_count2 = count ((getPosATL player) nearObjects ["ModularItems",DZE_PlotPole select 0]); // all epoch builables 
_count3 = count ((getPosATL player) nearObjects ["DZE_Base_Object",DZE_PlotPole select 0]); // epoch doors ( these are seperate)
 
_cnt = _count1 + _count2 + _count3;
 if (_cnt >= DZE_BuildingLimit) exitWith { //end script if too many objects nearby
  DZE_ActionInProgress = false;
  cutText [(localize "str_epoch_player_41"), "PLAIN DOWN"];
 };
 
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
_isWater = dayz_isSwimming;
_cancel = false;
_reason = "";
_canBuildOnPlot = false;
 
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
 
helperDetach = false; 
_canDo = (!r_drag_sqf and !r_player_unconscious);
 
_vector = [];
fnc_SetPitchBankYaw = { 
    private ["_object","_rotations","_aroundX","_aroundY","_aroundZ","_dirX","_dirY","_dirZ","_upX","_upY","_upZ","_dir","_up","_dirXTemp",
    "_upXTemp"];
    _object = _this select 0; 
    _rotations = _this select 1; 
    _aroundX = _rotations select 0; 
    _aroundY = _rotations select 1; 
    _aroundZ = (360 - (_rotations select 2)) - 360; 
    _dirX = 0; 
    _dirY = 1; 
    _dirZ = 0; 
    _upX = 0; 
    _upY = 0; 
    _upZ = 1; 
    if (_aroundX != 0) then { 
        _dirY = cos _aroundX; 
        _dirZ = sin _aroundX; 
        _upY = -sin _aroundX; 
        _upZ = cos _aroundX; 
    }; 
    if (_aroundY != 0) then { 
        _dirX = _dirZ * sin _aroundY; 
        _dirZ = _dirZ * cos _aroundY; 
        _upX = _upZ * sin _aroundY; 
        _upZ = _upZ * cos _aroundY; 
    }; 
    if (_aroundZ != 0) then { 
        _dirXTemp = _dirX; 
        _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ); 
        _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);        
        _upXTemp = _upX; 
        _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ); 
        _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
    }; 
    _dir = [_dirX,_dirY,_dirZ]; 
    _up = [_upX,_upY,_upZ]; 
    _object setVectorDirAndUp [_dir,_up];
DZE_BuildVector = [_dir,_up];
}; 
 
DZE_Q = false;
DZE_Z = false;
 
DZE_Q_alt = false;
DZE_Z_alt = false;
 
DZE_Q_ctrl = false;
DZE_Z_ctrl = false;
 
DZE_5 = false;
DZE_4 = false;
DZE_6 = false;
DZE_F = false;
 
DZE_cancelBuilding = false;
 
call gear_ui_init;
closeDialog 1;
 
if (_isWater) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_26", "PLAIN DOWN"];};
if (_inVehicle) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_42"), "PLAIN DOWN"];};
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [localize "str_player_21", "PLAIN DOWN"];};
if (player getVariable["combattimeout", 0] >= time) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_43"), "PLAIN DOWN"];};
 
_item = _this;
 
// Need Near Requirements
_abort = false;
_reason = "";
 
_needNear = getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");
 
{
switch(_x) do{
case "fire":
{
_distance = 3;
_isNear = {inflamed _x} count (_pos nearObjects _distance);
if(_isNear == 0) then {
_abort = true;
_reason = "fire";
};
};
case "workshop":
{
_distance = 3;
_isNear = count (nearestObjects [_pos, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
if(_isNear == 0) then {
_abort = true;
_reason = "workshop";
};
};
case "fueltank":
{
_distance = 30;
_isNear = count (nearestObjects [_pos, dayz_fuelsources, _distance]);
if(_isNear == 0) then {
_abort = true;
_reason = "fuel tank";
};
};
};
} forEach _needNear;
 
 
if(_abort) exitWith {
cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
DZE_ActionInProgress = false;
};
 
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
_classnametmp = _classname;
_require =  getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
 
_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then {
_lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable");
};
 
_requireplot = DZE_requireplot;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "requireplot")) then {
_requireplot = getNumber(configFile >> "CfgVehicles" >> _classname >> "requireplot");
};
 
_isAllowedUnderGround = 1;
if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
_isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
};
 
_offset = getArray (configFile >> "CfgVehicles" >> _classname >> "offset");
if((count _offset) <= 0) then {
_offset = [0,1.5,0];
};
 
_isPole = (_classname == "Plastic_Pole_EP1_DZ");
_isLandFireDZ = (_classname == "Land_Fire_DZ");
 
_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";
 
if(_isPole) then {
_distance = DZE_PlotPole select 1;
};
 
// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];
 
{
if (alive _x) then {
_findNearestPole set [(count _findNearestPole),_x];
};
} count _findNearestPoles;
 
_IsNearPlot = count (_findNearestPole);
 
// If item is plot pole && another one exists within 45m
if(_isPole && _IsNearPlot > 0) exitWith {  DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_44") , "PLAIN DOWN"]; };
 
if(_IsNearPlot == 0) then {
 
// Allow building of plot
if(_requireplot == 0 || _isLandFireDZ) then {
_canBuildOnPlot = true;
};
 
} else {
// Since there are plots nearby we check for ownership && then for friend status
 
// check nearby plots ownership && then for friend status
_nearestPole = _findNearestPole select 0;
 
// Find owner
_ownerID = _nearestPole getVariable ["CharacterID","0"];
 
// diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];
 
// check if friendly to owner
if(dayz_characterID == _ownerID) then {  //Keep ownership
// owner can build anything within his plot except other plots
if(!_isPole) then {
_canBuildOnPlot = true;
};
 
} else {
// disallow building plot
if(!_isPole) then {
/*Plot Management Start*/
_friendlies = _nearestPole getVariable ["plotfriends",[]];
_fuid  = [];
{
      _friendUID = _x select 0;
      _fuid  =  _fuid  + [_friendUID];
} forEach _friendlies;
_builder  = getPlayerUID player;
// check if friendly to owner
if(_builder in _fuid) then {
    _canBuildOnPlot = true;
};
/*Plot Management End*/
/* Replaced By Plot Management ** Edit.
_friendlies = player getVariable ["friendlyTo",[]];
// check if friendly to owner
if(_ownerID in _friendlies) then {
_canBuildOnPlot = true;
};
*/
};
};
};
 
// _message
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format[(localize "STR_EPOCH_PLAYER_135"),_needText,_distance] , "PLAIN DOWN"]; };
 
_missing = "";
_hasrequireditem = true;
{
_hastoolweapon = _x in weapons player;
if(!_hastoolweapon) exitWith { _hasrequireditem = false; _missing = getText (configFile >> "cfgWeapons" >> _x >> "displayName"); };
} count _require;
 
_hasbuilditem = _this in magazines player;
if (!_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };
 
if (!_hasrequireditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_137"),_missing] , "PLAIN DOWN"]; };
if (_hasrequireditem) then {
 
_location = [0,0,0];
_isOk = true;
 
// get inital players position
_location1 = [player] call FNC_GetPos;
_dir = getDir player;
 
// if ghost preview available use that instead
if (_ghost != "") then {
_classname = _ghost;
};
 
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
//Build gizmo
_objectHelper = "Sign_sphere10cm_EP1" createVehicle _location;
_helperColor = "#(argb,8,8,3)color(0,0,0,0,ca)";
_objectHelper setobjecttexture [0,_helperColor];
_objectHelper attachTo [player,_offset];
_object attachTo [_objectHelper,[0,0,0]];
_position = [_objectHelper] call FNC_GetPos;
 
_objHDiff = 0;
 
if (isClass (missionConfigFile >> "SnapBuilding" >> _classname)) then {
["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
};
 
DZE_updateVec = false;
DZE_memDir = getDir _objectHelper;
DZE_memForBack = 0;
DZE_memLeftRight = 0;
if !(_classname in DZE_noRotate) then{
s_player_setVectorsReset = player addaction ["Reset","Skilled\addons\snap_pro\player_vectorChange.sqf","reset"];
s_player_setVectorsForward = player addaction ["Pitch Forward","Skilled\addons\snap_pro\player_vectorChange.sqf","forward"];
s_player_setVectorsBack = player addaction ["Pitch Back","Skilled\addons\snap_pro\player_vectorChange.sqf","back"];
s_player_setVectorsLeft = player addaction ["Bank Left","Skilled\addons\snap_pro\player_vectorChange.sqf","left"];
s_player_setVectorsRight = player addaction ["Bank Right","Skilled\addons\snap_pro\player_vectorChange.sqf","right"];
s_player_setVectors1 = player addaction ["Increment by 1 degree","Skilled\addons\snap_pro\player_vectorChange.sqf","1"];
s_player_setVectors5 = player addaction ["Increment by 5 degrees","Skilled\addons\snap_pro\player_vectorChange.sqf","5"];
s_player_setVectors45 = player addaction ["Increment by 45 degrees","Skilled\addons\snap_pro\player_vectorChange.sqf","45"];
s_player_setVectors90 = player addaction ["Increment by 90 degrees","Skilled\addons\snap_pro\player_vectorChange.sqf","90"];
};
 
while {_isOk} do {
 
_zheightchanged = false;
_zheightdirection = "";
_rotate = false;
 
if (DZE_Q) then {
DZE_Q = false;
_zheightdirection = "up";
_zheightchanged = true;
};
if (DZE_Z) then {
DZE_Z = false;
_zheightdirection = "down";
_zheightchanged = true;
};
if (DZE_Q_alt) then {
DZE_Q_alt = false;
_zheightdirection = "up_alt";
_zheightchanged = true;
};
if (DZE_Z_alt) then {
DZE_Z_alt = false;
_zheightdirection = "down_alt";
_zheightchanged = true;
};
if (DZE_Q_ctrl) then {
DZE_Q_ctrl = false;
_zheightdirection = "up_ctrl";
_zheightchanged = true;
};
if (DZE_Z_ctrl) then {
DZE_Z_ctrl = false;
_zheightdirection = "down_ctrl";
_zheightchanged = true;
};
if (DZE_4) then {
_rotate = true;
DZE_4 = false;
_dir = -45;
DZE_memDir = DZE_memDir - 45;
};
if (DZE_6) then {
_rotate = true;
DZE_6 = false;
_dir = 45;
DZE_memDir = DZE_memDir + 45;
};
 
if(DZE_updateVec) then{
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
DZE_updateVec = false;
};
 
if (DZE_F and _canDo) then {
if (helperDetach) then {
_objectHelperDir = getDir _objectHelper; 
_objectHelper attachTo [player];
DZE_memDir = DZE_memDir-(getDir player);
helperDetach = false;
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
} else {
_objectHelperDir = getDir _objectHelper;
detach _objectHelper;
DZE_memDir = getDir _objectHelper;
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
[_objectHelper] call FNC_GetSetPos;
_objectHelper setVelocity [0,0,0]; //fix sliding glitch
helperDetach = true;
};
DZE_F = false;
};
 
if(_rotate) then {
if (helperDetach) then {
_objectHelperDir = getDir _objectHelper;
_objectHelper setDir _objectHelperDir+_dir;
[_objectHelper] call FNC_GetSetPos;
} else {
detach _objectHelper;
_objectHelperDir = getDir _objectHelper;
_objectHelper setDir _objectHelperDir+_dir;
[_objectHelper] call FNC_GetSetPos;
_objectHelperDir = getDir _objectHelper;
_objectHelper attachTo [player];
_objectHelper setDir _objectHelperDir-(getDir player);
};
 
};
 
if(_zheightchanged) then {
if (!helperDetach) then {
detach _objectHelper;
_objectHelperDir = getDir _objectHelper;
};
 
_position = [_objectHelper] call FNC_GetPos;
 
if(_zheightdirection == "up") then {
_position set [2,((_position select 2)+0.1)];
_objHDiff = _objHDiff + 0.1;
};
if(_zheightdirection == "down") then {
_position set [2,((_position select 2)-0.1)];
_objHDiff = _objHDiff - 0.1;
};
 
if(_zheightdirection == "up_alt") then {
_position set [2,((_position select 2)+1)];
_objHDiff = _objHDiff + 1;
};
if(_zheightdirection == "down_alt") then {
_position set [2,((_position select 2)-1)];
_objHDiff = _objHDiff - 1;
};
 
if(_zheightdirection == "up_ctrl") then {
_position set [2,((_position select 2)+0.01)];
_objHDiff = _objHDiff + 0.01;
};
if(_zheightdirection == "down_ctrl") then {
_position set [2,((_position select 2)-0.01)];
_objHDiff = _objHDiff - 0.01;
};
 
if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
_position set [2,0];
};
 
if (surfaceIsWater _position) then {
_objectHelper setPosASL _position;
} else {
_objectHelper setPosATL _position;
};
 
if (!helperDetach) then {
_objectHelper attachTo [player];
_objectHelper setDir _objectHelperDir-(getDir player);
};
 
[_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
};
 
sleep 0.5;
 
_location2 = [player] call FNC_GetPos;
_objectHelperPos = [_objectHelper] call FNC_GetPos;
 
if(DZE_5) exitWith {
_isOk = false;
_position = [_object] call FNC_GetPos;
detach _object;
_dir = getDir _object;
_vector = [(vectorDir _object),(vectorUp _object)];
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
 
if(_location1 distance _location2 > 10) exitWith {
_isOk = false;
_cancel = true;
_reason = "You've moved to far away from where you started building (within 10 meters)";
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
 
if(_location1 distance _objectHelperPos > 10) exitWith {
_isOk = false;
_cancel = true;
_reason = "Object is placed to far away from where you started building (within 10 meters)";
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
 
if(abs(_objHDiff) > 10) exitWith {
_isOk = false;
_cancel = true;
_reason = "Cannot move up or down more than 10 meters";
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
 
if (player getVariable["combattimeout", 0] >= time) exitWith {
_isOk = false;
_cancel = true;
_reason = (localize "str_epoch_player_43");
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
 
if (DZE_cancelBuilding) exitWith {
_isOk = false;
_cancel = true;
_reason = "Cancelled building.";
detach _object;
deleteVehicle _object;
detach _objectHelper;
deleteVehicle _objectHelper;
};
};
 
if !(_classname in DZE_noRotate) then{
player removeAction s_player_setVectorsReset;
player removeAction s_player_setVectorsForward;
player removeAction s_player_setVectorsBack;
player removeAction s_player_setVectorsLeft;
player removeAction s_player_setVectorsRight;
player removeAction s_player_setVectors1;
player removeAction s_player_setVectors5;
player removeAction s_player_setVectors45;
player removeAction s_player_setVectors90;
};
 
//No building on roads unless toggled
if (!DZE_BuildOnRoads) then {
if (isOnRoad _position) then { _cancel = true; _reason = "Cannot build on a road."; };
};
 
// No building in trader zones
if(!canbuild) then { _cancel = true; _reason = "Cannot build in a city."; };
 
if(!_cancel) then {
 
_classname = _classnametmp;
 
// Start Build
_tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
 
_tmpbuilt setdir _dir;
 
_tmpbuilt setVectorDirAndUp _vector;
 
// Get position based on object
_location = _position;
 
if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
_location set [2,0];
};
 
_buildOffset = [0,0,0];
_vUp = _vector select 1;
switch (_classname) do {
case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
};
 
_location = [
(_location select 0) - (_buildOffset select 0),
(_location select 1) - (_buildOffset select 1),
(_location select 2) - (_buildOffset select 2)
];
 
if (surfaceIsWater _location) then {
_tmpbuilt setPosASL _location;
_location = ASLtoATL _location;
} else {
_tmpbuilt setPosATL _location;
};
 
cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];
 
_limit = 3;
 
if (DZE_StaticConstructionCount > 0) then {
_limit = DZE_StaticConstructionCount;
}
else {
if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
_limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
};
};
 
_isOk = true;
_proceed = false;
_counter = 0;
 
while {_isOk} do {
 
[10,10] call dayz_HungerThirst;
player playActionNow "Medic";
 
_dis=20;
_sfx = "repair";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
 
r_interrupt = false;
r_doLoop = true;
_started = false;
_finished = false;
 
while {r_doLoop} do {
_animState = animationState player;
_isMedic = ["medic",_animState] call fnc_inString;
if (_isMedic) then {
_started = true;
};
if (_started && !_isMedic) then {
r_doLoop = false;
_finished = true;
};
if (r_interrupt || (player getVariable["combattimeout", 0] >= time)) then {
r_doLoop = false;
};
if (DZE_cancelBuilding) exitWith {
r_doLoop = false;
};
sleep 0.1;
};
r_doLoop = false;
 
 
if(!_finished) exitWith {
_isOk = false;
_proceed = false;
};
 
if(_finished) then {
_counter = _counter + 1;
};
 
cutText [format[(localize "str_epoch_player_139"),_text, _counter,_limit], "PLAIN DOWN"];
 
if(_counter == _limit) exitWith {
_isOk = false;
_proceed = true;
};
 
};
 
if (_proceed) then {
 
_num_removed = ([player,_item] call BIS_fnc_invRemove);
if(_num_removed == 1) then {
 
cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];
 
if (_isPole) then {
[] spawn player_plotPreview;
};
 
_tmpbuilt setVariable ["OEMPos",_location,true];
 
if(_lockable > 1) then {
 
_combinationDisplay = "";
 
switch (_lockable) do {
 
case 2: { // 2 lockbox
_combination_1 = (floor(random 3)) + 100; // 100=red,101=green,102=blue
_combination_2 = floor(random 10);
_combination_3 = floor(random 10);
_combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
dayz_combination = _combination;
if (_combination_1 == 100) then {
_combination_1_Display = "Red";
};
if (_combination_1 == 101) then {
_combination_1_Display = "Green";
};
if (_combination_1 == 102) then {
_combination_1_Display = "Blue";
};
_combinationDisplay = format["%1%2%3",_combination_1_Display,_combination_2,_combination_3];
};
 
case 3: { // 3 combolock
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
_combination_3 = floor(random 10);
_combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
dayz_combination = _combination;
_combinationDisplay = _combination;
};
 
case 4: { // 4 safe
_combination_1 = floor(random 10);
_combination_2 = floor(random 10);
_combination_3 = floor(random 10);
_combination_4 = floor(random 10);
_combination = format["%1%2%3%4",_combination_1,_combination_2,_combination_3,_combination_4];
dayz_combination = _combination;
_combinationDisplay = _combination;
};
};
 
_tmpbuilt setVariable ["CharacterID",_combination,true];
 
 
PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_vector],_classname];
publicVariableServer "PVDZE_obj_Publish";
 
cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];
 
 
} else {
_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
 
// fire?
if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
_tmpbuilt spawn player_fireMonitor;
} else {
PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_vector],_classname];
publicVariableServer "PVDZE_obj_Publish";
};
};
} else {
deleteVehicle _tmpbuilt;
cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
};
 
} else {
r_interrupt = false;
if (vehicle player == player) then {
[objNull, player, rSwitchMove,""] call RE;
player playActionNow "stop";
};
 
deleteVehicle _tmpbuilt;
 
cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
};
 
} else {
cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
};
};
 
DZE_ActionInProgress = false;

A list of the mods im using that could effect it:
Snap Pro V1.4.?+Build Vectors&Precise Base Building (Version where you had to combine precise & vectors yourself)

Vehicle Paint

JAEM?

 

Builds

Arma 2 OA beta 125548

DayZ Epoch 1.5.01

DayZ Overwatch 0.2.5

dayztaviana.com's DayZ Taviana 2.0

 

 

please let me know if I should post any other files.

Any help would be forever appreciated.

 

 

Thanks

 

 

 

Edit:Update

So I was just testing some edited files I was trying to see if they worked and of course like when i had the vehicles reverting bug I had the fixed for a long time (this time only 3 hours) but still because it took me forever to type up my previous post I couldn't tell you what fixed it for me actually I could I think what fixed it was a simple define to the fnselfactions which if it was that then its because I was looking on um... someother working servers mission file that only had plot management but found this and was like thats weird but tried it so if you think this might help.

in your fnselfactions make sure you have this line somewhere before the plot management code.

_playerUID = getPlayerUID player;

I have mine placed where other variables are being defined.

    
    _isAlive = alive _cursorTarget;
    
    _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");
    
    _rawmeat = meatraw;
    _hasRawMeat = false;
    _playerUID = getPlayerUID player; //here
    {
 

Or the more likely cause is I think awhile ago in my server_monitor when installing Zupa SC3.0 when replacing the inventory block I thought it wanted me to remove this part.

if(_isNormal)then { //<<<< This

_inventory = [
getWeaponCargo _object,
xxxetcetc
];
}; //<<<< This

So I readded now Mine and people I adds PUIDs and names are getting saved to plot poles and doors yay but I still have the bugs with the scroll wheels which I will take up the door management bug on that topic but I still have it where if look at a plot pole im not added to all my actions that are in my fnselfactions disappear.

Link to comment
Share on other sites

Hey Zupa,

 

I am facing some issues with my epoch server and plot Management I believe I have it installed correctly but when I am in game and place a plot pole then scroll on it there is no management option, The only Options I get are:

 

Maintain Area

Maintain Area Preview

Show Plot Boundary

Remove 30m Plot Pole

 

 

Any idea why I cant get the option to come up? I have been working non stop trying to make this work but it just wont  :(

Link to comment
Share on other sites

hey zupa, great mod, but theres a few things i was concerned about ...

 

i installed this without plot for life and when i build a plotpole it does not come with the builders uid and name pre entered in it, so i modified player_build and added this:

if(_tmpbuilt isKindOf "Plastic_Pole_EP1_DZ") then {
	_tmpbuilt setVariable ["plotfriends",[[(getPlayerUID player),(name player)]],true];
	PVDZE_veh_Update = [_tmpbuilt,"gear"];
	publicVariableServer "PVDZE_veh_Update";
};

right below this:

if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
	_tmpbuilt spawn player_fireMonitor;
} else {
	PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location],_classname];
	publicVariableServer "PVDZE_obj_Publish";

and this seems to work fine ...

 

also in the edits for fn_selfactions.sqf you have an undefined variable in _playerUID, my guess is you forgot to add this somewhere?:

_playerUID = getPlayerUID player;

i added it right below this line myself so it wont have to check player uid each time it calls fn_selfactions, but only when conditions are met:

if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then {

other than that, i think its really cool mod, thanks for sharing this.

 

edit:

oh and i forgot to mention, you could make it way easier for users by adding an sql string to run on the database and fetch all pre mod poles and add owners (names and uid's) to inventory field ("plotfriends") on all pre mod poles, just saying its possible.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...