Jump to content

[Release] - A Plot for life v2.5. Keep your buildables on death. Take plot ownership


Recommended Posts

Sorry, I am not sure what you are after.

 

The maintenance feature in Epoch only happens when buildings are damaged past a set amount.  To simulate 'decay' Epoch comes with a set of SQL events which cause decay damage daily to any buildables.  The code to enable these events are in the SQL directory of the Epoch server download.

 

If you remove the events that cause the decay damage then your buildables would not be automatically damaged but there are other events in the Epoch supplied SQL that you should keep which help to clear away destroyed items etc.

 

Running

DROP EVENT IF EXISTS `setDamageOnAge`;

Should stop the buildables being damaged as part of the maintenance feature.

Sry was my fail, have wrong worded it,

So what i mean is that my building stuff like walls etc. have godmode so they cant be destroyed.

but as far as i know this script also set the damage on every restart to 0.

so the build in epoch sql event doesnt work for me and i search a other way to cleanup old bases.

beforce i changed to this script i had the one from WGC Geekgarage and there i had this sql querry automaticlly run every 3 days:

 

DELETE FROM `Object_DATA` WHERE `CharacterID` IN (SELECT `PlayerUID` FROM `Character_DATA` WHERE `Alive`='1' and DATE(`LastLogin`) < CURDATE() - INTERVAL 30 DAY)

but this cant work with your script cause you store the PlayerUID in the worldspace  collum instead of the characterID collum.

So my main question was if you (or another  one) could make me a sql script which search for old players in the character_data get the playerUID from theese chars and search for the PlayerUID in the worldspace collum in object_data and then delete all entrys who was found.

Link to comment
Share on other sites

Ok i've asked everywhere and i still don't know so i thought i could quickly ask you Rimblock,

 

Where do i change the distance where you place another plot pole the default is 45 and i can't find where you change it anywhere

 

I have 120 meter plot pole radius and this allows players to overlap plotpoles and be able to build

 

Any  help

Thanks

Link to comment
Share on other sites

Ok i've asked everywhere and i still don't know so i thought i could quickly ask you Rimblock,

 

Where do i change the distance where you place another plot pole the default is 45 and i can't find where you change it anywhere

 

I have 120 meter plot pole radius and this allows players to overlap plotpoles and be able to build

 

Any  help

Thanks

 

Easy one first  :) .

 

Variables.sqf has it 

if(isNil "DZE_PlotPole") then {
DZE_PlotPole = [30,45];
};

The first number is the radius you can build in (i.e. you can build within a 30 mtr radius of the pole), the second is the closest you can build another plot pole (in the default case, 45 mtrs radius meaning there is no overlap).

 

You can override it in the init.sqf using the same variable (DZE_PlotPole=[]).

Link to comment
Share on other sites

Sry was my fail, have wrong worded it,

So what i mean is that my building stuff like walls etc. have godmode so they cant be destroyed.

but as far as i know this script also set the damage on every restart to 0.

so the build in epoch sql event doesnt work for me and i search a other way to cleanup old bases.

beforce i changed to this script i had the one from WGC Geekgarage and there i had this sql querry automaticlly run every 3 days:

 

DELETE FROM `Object_DATA` WHERE `CharacterID` IN (SELECT `PlayerUID` FROM `Character_DATA` WHERE `Alive`='1' and DATE(`LastLogin`) < CURDATE() - INTERVAL 30 DAY)

but this cant work with your script cause you store the PlayerUID in the worldspace  collum instead of the characterID collum.

So my main question was if you (or another  one) could make me a sql script which search for old players in the character_data get the playerUID from theese chars and search for the PlayerUID in the worldspace collum in object_data and then delete all entrys who was found.

 

The same code should work.

 

A Plot for Life v2+ stores the PlayerUID in the worldspace and the characterID where it should go.  The problem of course is that as characterIDs change (i.e. the player dies) the sql will remove their buildables after XX days.

 

If you want it to delete based on the playerUID of the owner then I will need to write a bit of sql that can take the ownerUID from the worldspace field.  Should not be too hard and will take a look tomorrow.

Link to comment
Share on other sites

I've redone the install of both mods now at least 10 times trying to find the magical alignment to make it all work, I even did a fresh reinstall of my test server and tried, still same results. I think the issue has to do with the way the objects are being written to the DB because vanilla Epoch does not save the character ID to objects after a restart, so even if you changed the script to have the object associated with a PUid vs Character ID it would still not save. Obvioulsy I am doing something wrong as other people have gotten it to work and I have not, I did see McPimpin ask about this exact issue in an earlier thread but I never saw an answer for it. If I used the merged player_build.sqf it fucks everything up royally, and I know that everthing is pointed the way it should be, so instead I am using both player_build.sqf's via my custom compiles and the snap_pro custom compiles and that makes everything work. Both scripts work perfectly until restart. Then after that the snap_pro still works perfectly and the P4L works as designed but only with new objects placed, any object placed before acts like I'm a complete stranger, so this has to be a problem with the PUid not being saved to objects in the DB. May look into trying to write an SQL trigger to force the PUid saving to objects if I can't figure this out. When I look in the DB, the PUid saves to the worldspace of associated objects, and the character ID stays the same with the exception of vaults it would appear, so very confusing.

 

Yes, you are right, it can be very frustrating.

 

I also understand that Raymix has released an updated version of the snapbuild pro and as the merged file in my first post was merged with the original snap build pro player_build, that is probably not helping.

 

This is my compiles.sqf

/*
FUNCTION COMPILES
*/
//Player only
if (!isDedicated) then {
 
"filmic" setToneMappingParams [0.07, 0.31, 0.23, 0.37, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
 
BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie
player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
fnc_usec_damageActions = compile preprocessFileLineNumbers "Custom\PlotForLifev2\fn_damageActions.sqf"; //Checks which actions for nearby casualty
fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
fnc_usec_selfActions = compile preprocessFileLineNumbers "Custom\PlotForLifev2\fn_selfActions.sqf"; //Checks which actions for self
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";
player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
player_dumpBackpack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_dumpBackpack.sqf";
building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf";
building_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnZombies.sqf";
dayz_spaceInterrupt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\dayz_spaceInterrupt.sqf";
player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf"; //Runs when player fires. Alerts nearby Zeds depending on calibre && audial rating
player_harvest = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_harvest.sqf";
player_packTent = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_packTent.sqf";
player_packVault = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_packVault.sqf";
player_unlockVault = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_unlockVault.sqf";
 
player_removeObject = compile preprocessFileLineNumbers "Custom\PlotForLifev2\remove.sqf";
player_removeNearby =     compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_removeNearby.sqf";
 
player_removeTankTrap = {
//Object Array, Range, Error Message (@Skaronator)
[["Hedgehog_DZ"], 1,"STR_EPOCH_ACTIONS_14"] call player_removeNearby;
};
player_removeNet = {
[["DesertLargeCamoNet","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ"], 5,"str_epoch_player_8"] call player_removeNearby;
};
 
player_login = {
private ["_unit","_detail"];
_unit = _this select 0;
_detail = _this select 1;
if(_unit == getPlayerUID player) then {
player setVariable["publish",_detail];
};
};
 
player_unlockDoor = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";
player_changeCombo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_changeCombo.sqf"; 
 
player_lockVault = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_lockVault.sqf";
player_updateGui = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_updateGui.sqf";
player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
player_switchModel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_switchModel.sqf";
player_checkStealth = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_checkStealth.sqf";
world_sunRise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_sunRise.sqf";
world_surfaceNoise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_surfaceNoise.sqf";
player_humanityMorph = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityMorph.sqf";
player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
fn_gearMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf";
 
//Objects
object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf";
object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
 
local_roadDebris = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_roadDebris.sqf";
 
//Zombies
zombie_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
wild_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\wild_spawnZombies.sqf"; //Server compile, used for loiter behaviour
 
pz_attack = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf";
 
dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
 
//actions
player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
player_copyKey = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_copyKey.sqf";
player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
player_loadCrate = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_loadCrate.sqf";
player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
player_tentPitch = compile preprocessFileLineNumbers "Custom\PlotForLifev2\tent_pitch.sqf";
player_vaultPitch = compile preprocessFileLineNumbers "Custom\PlotForLifev2\vault_pitch.sqf";
player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
player_eat = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_eat.sqf";
player_useMeds = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useMeds.sqf";
player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
player_harvestPlant = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_harvestPlant.sqf";
player_goFishing = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_goFishing.sqf";
player_build = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_build.sqf";
player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
player_antiWall = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_antiWall.sqf";
player_deathBoard = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\list_playerDeathsAlt.sqf";
 
player_plotPreview = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_showPlotRadius.sqf";
player_upgradeVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_upgradeVehicle.sqf";
 
//ui
player_selectSlot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";
player_gearSync = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSync.sqf";
player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
ui_gear_sound =             compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf";
 
//System
player_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_monitor.sqf";
player_spawn_1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_1.sqf";
player_spawn_2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_2.sqf";
onPreloadStarted "dayz_preloadFinished = false;";
onPreloadFinished "dayz_preloadFinished = true;";
 
// helper functions
player_hasTools = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_hasTools.sqf";
player_checkItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_checkItems.sqf";
player_removeItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_removeItems.sqf";
//Trader ["Trader City Name",false,"enter"] - Trader City Name | Show Message | "enter" || "leave"
player_traderCity = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderCity.sqf";
 
// combination of check && remove items
player_checkAndRemoveItems = {
private ["_items","_b"];
_items = _this;
_b = _items call player_checkItems;
if (_ B) then {
_b = _items call player_removeItems;
};
_b
};
 
dayz_HungerThirst = {
dayz_hunger = dayz_hunger + (_this select 0);
dayz_thirst = dayz_thirst + (_this select 1);
};
 
epoch_totalCurrency = {
// total currency
_total_currency = 0;
{
_part =  (configFile >> "CfgMagazines" >> _x);
_worth =  (_part >> "worth");
if isNumber (_worth) then {
_total_currency = _total_currency + getNumber(_worth);
};
} count (magazines player);
_total_currency
};
 
epoch_itemCost = {
_trade_total = 0;
{
_part_in_configClass =  configFile >> "CfgMagazines" >> (_x select 0);
if (isClass (_part_in_configClass)) then {
_part_inWorth = (_part_in_configClass >> "worth");
if isNumber (_part_inWorth) then {
_trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
};
};
} count _this;
 
//diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
_trade_total
};
 
epoch_returnChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf";
// usage [["partinclassname",4]] call epoch_returnChange;
 
dayz_losChance = {
private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
_agent = _this select 0;
_dis = _this select 1;
_maxDis = _this select 2;
// diag_log ("VAL:  " + str(_this));
_val = (_maxDis - _dis) max 0;
_maxExp = ((exp 2) * _maxDis);
_myExp = ((exp 2) * (_val)) / _maxExp;
_myExp = _myExp * 0.7;
_myExp
};
 
ui_initDisplay = {
private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"];
disableSerialization;
_display = uiNamespace getVariable 'DAYZ_GUI_display';
_control = _display displayCtrl 1204;
_control ctrlShow false;
if (!r_player_injured) then {
_ctrlBleed = _display displayCtrl 1303;
_ctrlBleed ctrlShow false;
};
if (!r_fracture_legs && !r_fracture_arms) then {
_ctrlFracture = _display displayCtrl 1203;
_ctrlFracture ctrlShow false;
};
_ctrlDogFoodBorder = _display displayCtrl 1501;
_ctrlDogFoodBorder ctrlShow false;
_ctrlDogFood = _display displayCtrl 1701;
_ctrlDogFood ctrlShow false;
 
_ctrlDogWaterBorder = _display displayCtrl 1502;
_ctrlDogWaterBorder ctrlShow false;
_ctrlDogWater = _display displayCtrl 1702;
_ctrlDogWater ctrlShow false
};
 
dayz_losCheck = {
private["_target","_agent","_cantSee"];
_target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
_agent = _this select 1;
_cantSee = true;
if (!isNull _target) then {
 
_tPos = visiblePositionASL _target;
_zPos = visiblePositionASL _agent;
 
_tPos set [2,(_tPos select 2)+1];
_zPos set [2,(_zPos select 2)+1];
 
if ((count _tPos > 0) && (count _zPos > 0)) then {
_cantSee = terrainIntersectASL [_tPos, _zPos];
if (!_cantSee) then {
_cantSee = lineIntersects [_tPos, _zPos, _agent, vehicle _target];
};
};
};
_cantSee
};
 
dayz_equipCheck = {
private ["_empty", "_needed","_diff","_success"];
_config = _this;
_empty = [player] call BIS_fnc_invSlotsEmpty;
_needed = [_config] call BIS_fnc_invSlotType;
_diff = [_empty,_needed] call BIS_fnc_vectorDiff;
 
_success = true;
{
if (_x > 0) then {_success = false};
} count _diff;
hint format["Config: %5\nEmpty: %1\nNeeded: %2\nDiff: %3\nSuccess: %4",_empty,_needed,_diff,_success,_config];
_success
};
 
vehicle_gear_count = {
private["_counter"];
_counter = 0;
{
_counter = _counter + _x;
} count _this;
_counter
};
 
player_tagFriendlyMsg = {
if(player == (_this select 0)) then {
cutText[(localize "str_epoch_player_2"),"PLAIN DOWN"];
};
};
 
player_serverModelChange = {
private["_object","_model"];
_object = _this select 0;
_model = _this select 1;
if (_object == player) then {
_model call player_switchModel;
};
};
 
player_guiControlFlash = {
private["_control"];
_control = _this;
if (ctrlShown _control) then {
_control ctrlShow false;
} else {
_control ctrlShow true;
};
};
 
gearDialog_create = {
private ["_i","_dialog"];
if (!isNull (findDisplay 106)) then {
(findDisplay 106) closeDisplay 0;
};
openMap false;
closeDialog 0;
if (gear_done) then {sleep 0.001;};
player action ["Gear", player];
if (gear_done) then {sleep 0.001;};
_dialog = findDisplay 106;
_i = 0;
while {isNull _dialog} do {//DO NOT CHANGE TO A FOR LOOP!
_i = _i + 1;
_dialog = findDisplay 106;
if (gear_done) then {sleep 0.001;};
if (_i in [100,200,299]) then {
closeDialog 0;
player action ["Gear", player];
};
if (_i > 300) exitWith {};
};
if (gear_done) then {sleep 0.001;};
_dialog = findDisplay 106;
if ((parseNumber(_this select 0)) != 0) then {
ctrlActivate (_dialog displayCtrl 157);
if (gear_done) then {
waitUntil {ctrlShown (_dialog displayCtrl 159)};
sleep 0.001;
};
};
_dialog
};
 
gear_ui_offMenu = {
private["_control","_parent","_menu"];
disableSerialization;
_control = _this select 0;
_parent = findDisplay 106;
if (!(_this select 3)) then {
for "_i" from 0 to 9 do {
_menu = _parent displayCtrl (1600 + _i);
_menu ctrlShow false;
};
_grpPos = ctrlPosition _control;
_grpPos set [3,0];
_control ctrlSetPosition _grpPos;
_control ctrlShow false;
_control ctrlCommit 0;
};
};
 
dze_surrender_off = {
player setVariable ["DZE_Surrendered", false, true];
DZE_Surrender = false;
};
 
gear_ui_init = {
private["_control","_parent","_menu","_dspl","_grpPos"];
disableSerialization;
_parent = findDisplay 106;
_control = _parent displayCtrl 6902;
for "_i" from 0 to 9 do {
_menu = _parent displayCtrl (1600 + _i);
_menu ctrlShow false;
};
_grpPos = ctrlPosition _control;
_grpPos set [3,0];
_control ctrlSetPosition _grpPos;
_control ctrlShow false;
_control ctrlCommit 0;
};
 
dayz_eyeDir = {
private["_vval","_vdir"];
_vval = (eyeDirection _this);
_vdir = (_vval select 0) atan2 (_vval select 1);
if (_vdir < 0) then {_vdir = 360 + _vdir};
_vdir
};
 
DZE_getModelName = {
_objInfo = toArray(str(_this));
_lenInfo = count _objInfo - 1;
_objName = [];
_i = 0;
// determine where the object name starts
{
if (58 == _objInfo select _i) exitWith {};
_i = _i + 1;
} count _objInfo;
_i = _i + 2; // skip the ": " part
for "_k" from _i to _lenInfo do {
_objName set [(count _objName), (_objInfo select _k)];
};
_objName = toLower(toString(_objName));
_objName
};
 
dze_isnearest_player = {
private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
if(!isNull _this) then {
_nearPlayers = _this nearEntities ["CAManBase", 12];
_playerNear = ({isPlayer _x} count _nearPlayers) > 1;
_notClosest = false;
if (_playerNear) then {
// check if another player is closer
_playerDistance = player distance _this;
{
if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
} count _nearPlayers;
};
} else {
_notClosest = false;
};
_notClosest
};
 
// trader menu code
if (DZE_ConfigTrader) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";
}else{
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf";
};
// recent murders menu code
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_murderMenu.sqf";
 
//This is still needed but the fsm should terminate if any errors pop up.
[] spawn {
        private["_timeOut","_display","_control1","_control2"];
        disableSerialization;
        _timeOut = 0;
        dayz_loadScreenMsg = "";
        diag_log "DEBUG: loadscreen guard started.";
        _display = uiNameSpace getVariable "BIS_loadingScreen";
        if (!isNil "_display") then {
                _control1 = _display displayctrl 8400;
                _control2 = _display displayctrl 102;
        };
if (!isNil "dayz_DisplayGenderSelect") then {
waitUntil {!dayz_DisplayGenderSelect};
};
 
        // 120 sec timeout (12000 * 0.01)
        while { _timeOut < 12000 } do {
            if (dayz_clientPreload && dayz_authed) exitWith { diag_log "PLOGIN: Login loop completed!"; };
            if (!isNil "_display") then {
                if ( isNull _display ) then {
                        waitUntil { !dialog; };
                        startLoadingScreen ["","RscDisplayLoadCustom"];
                        _display = uiNameSpace getVariable "BIS_loadingScreen";
                        _control1 = _display displayctrl 8400;
                        _control2 = _display displayctrl 102;
                };
 
                if ( dayz_loadScreenMsg != "" ) then {
                        _control1 ctrlSetText dayz_loadScreenMsg;
                        dayz_loadScreenMsg = "";
                };
 
                _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
            };
 
            _timeOut = _timeOut + 1;
 
            if (_timeOut >= 12000) then {
                1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
                sleep 10;
                endLoadingScreen;
                endMission "END1";
            };
 
            sleep 0.01;
        };
};
 
dayz_meleeMagazineCheck = {
                private["_meleeNum","_magType"];
                _magType =         ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
                _meleeNum = ({_x == _magType} count magazines player);
                if (_meleeNum < 1) then {
                        player addMagazine _magType;
                };
        };
 
dayz_originalPlayer = player;
 
progressLoadingScreen 0.8;
};
 
//Both
BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf";
BIS_fnc_vectorAdd =         compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf";
BIS_fnc_halo =              compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_halo.sqf";
BIS_fnc_findNestedElement = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_findNestedElement.sqf";
BIS_fnc_param = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_param.sqf";
 
fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; //Event handler run on damage
 
// object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
object_setHitServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHitServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_getHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_getHit.sqf"; //gets the hit value for a HitPoint (i.e. HitLegs) against the selection (i.e. "legs"), returns the value
object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records && sets hit)
object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
// object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player || server to monitor changes in cargo contents
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
// Vehicle damage fix
vehicle_handleDamage    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
vehicle_handleKilled    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
//fnc_vehicleEventHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\vehicle_init.sqf"; //Initialize vehicle
fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding2;
fnc_isInsideBuilding3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding3.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding3;
dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (|| local to unit) when gutting an object
local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle
local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (|| local to unit) when gutting an object
local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
//player_weaponCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponCheck.sqf"; //Run by the player || server to monitor whether they have picked up a new weapon
curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf";
player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
world_isDay = {if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {true} else {false}};
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";
// player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
FNC_GetSetPos = { //DO NOT USE IF YOU NEED ANGLE COMPENSATION!!!!
private "_pos";
_thingy = _this select 0;
_pos = getPosASL _thingy;
if (surfaceIsWater _pos) then {
_thingy setPosASL _pos;
} else {
_thingy setPosATL (ASLToATL _pos);
};
};
FNC_GetPos = {
private "_pos";
if (isNil {_this select 0}) exitWith {[0,0,0]};
_thingy = _this select 0;
_pos = getPosASL _thingy;
if !(surfaceIsWater _pos) then {
_pos =  ASLToATL _pos;
};
_pos
};
local_setFuel = {
private["_qty","_vehicle"];
_vehicle = _this select 0;
_qty = _this select 1;
_vehicle setFuel _qty;
};
zombie_initialize = {
private ["_unit","_position"];
_unit = _this select 0;
if (isServer) then {
_unit addEventHandler ["local", {_this call zombie_findOwner}];
};
_id = _unit addeventhandler["HandleDamage", { _this call local_zombieDamage }];
_id = _unit addeventhandler["Killed", { [_this, "zombieKills"] call local_eventKill }];
};
 
dayz_EjectPlayer = {
// check if player in vehicle
        private ["_noDriver","_vehicle","_inVehicle"];
        _vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if(_inVehicle) then {
_noDriver = ((_vehicle emptyPositions "driver") > 0);
if (_noDriver && (speed _vehicle) != 0) then {
player action [ "eject", _vehicle];
};
};
};
 
player_sumMedical = {
private["_character","_wounds","_legs","_arms","_medical"];
_character = _this;
_wounds = [];
if (_character getVariable["USEC_injured",false]) then {
{
if (_character getVariable[_x,false]) then {
_wounds set [count _wounds,_x];
};
} count USEC_typeOfWounds;
};
_legs = _character getVariable ["hit_legs",0];
_arms = _character getVariable ["hit_arms",0];
_medical = [
_character getVariable["USEC_isDead",false],
_character getVariable["NORRN_unconscious", false],
_character getVariable["USEC_infected",false],
_character getVariable["USEC_injured",false],
_character getVariable["USEC_inPain",false],
_character getVariable["USEC_isCardiac",false],
_character getVariable["USEC_lowBlood",false],
_character getVariable["USEC_BloodQty",12000],
_wounds,
[_legs,_arms],
_character getVariable["unconsciousTime",0],
_character getVariable["messing",[0,0]]
];
_medical
};
 
//Server Only
if (isServer) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
} else {
eh_localCleanup = {};
};
 
if (!isDedicated) then {
/* Use command menu instead of scroll menu? (default = false) */
DZE_SNAP_PRO_USE_COMMAND_MENU = false;
 
DZE_SNAP_BUILD_NUMKEYS = [0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B];
 
snap_build = compile preprocessFileLineNumbers "custom\snap_pro\snap_build.sqf";
dayz_spaceInterrupt = compile preprocessFileLineNumbers "custom\snap_pro\dayz_spaceInterrupt.sqf";
};
 
initialized = true;

 
Here is my init.sqf

/*
For DayZ Epoch
Addons Credits: Jetski Yanahui by Kol9yN, Zakat, Gerasimow9, YuraPetrov, zGuba, A.Karagod, IceBreakr, Sahbazz
*/
diag_log text "Init.sqf starting";
 
startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//REALLY IMPORTANT VALUES
dayZ_instance = 11; //The instance
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;
 
DZEdebug = true;
 
DZE_BuildingLimit = 300;
DZE_StaticConstructionCount = 1;
 
//disable greeting menu 
player setVariable ["BIS_noCoreConversations", true];
//disable radio messages to be heard and shown in the left lower corner of the screen
enableRadio false;
// May prevent "how are you civillian?" messages from NPC
enableSentences false;
 
// DayZ Epoch config
spawnShoremode = 1; // Default = 1 (on shore)
spawnArea= 1500; // Default = 1500
 
MaxVehicleLimit = 300; // Default = 50
MaxDynamicDebris = 500; // Default = 100
dayz_MapArea = 14000; // Default = 10000
dayz_maxLocalZombies = 30; // Default = 30 
 
dayz_paraSpawn = false;
 
dayz_minpos = -1; 
dayz_maxpos = 16000;
 
dayz_sellDistance_vehicle = 10;
dayz_sellDistance_boat = 30;
dayz_sellDistance_air = 40;
 
dayz_maxAnimals = 5; // Default: 8
dayz_tameDogs = true;
DynamicVehicleDamageLow = 0; // Default: 0
DynamicVehicleDamageHigh = 100; // Default: 100
 
DZE_BuildOnRoads = false; // Default: False
 
EpochEvents = [["any","any","any","any",30,"crash_spawner"],["any","any","any","any",0,"crash_spawner"],["any","any","any","any",15,"supply_drop"]];
dayz_fullMoonNights = true;
 
diag_log text "Init.sqf Start call compiles.";
 
//Load in compiled functions
call compile preprocessFileLineNumbers "init\variables.sqf"; //Initilize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf"; //Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf"; //Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "init\compiles.sqf"; //Compile regular functions
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "server_traders.sqf"; //Compile trader configs
progressLoadingScreen 1.0;
 
diag_log text "Init.sqf Start call compiles.";
 
"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
 
if (isServer) then {
 
diag_log text "Init.sqf Is Server start.";
 
call compile preprocessFileLineNumbers "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";
//Compile vehicle configs
 
// Add trader citys
_nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";
 
diag_log text "APlotForLife";
_serverMonitor = [] execVM "custom\APlotForLifev2.2.1\server_monitor.sqf";
diag_log format["[_serverMonitor: %1]",_serverMonitor];
 
diag_log text "Init.sqf Is Server End.";
};
 
if (!isDedicated) then {
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
 
//anti Hack
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
 
//Lights
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
 
};
 
#include "\z\addons\dayz_code\system\REsec.sqf"
 
//Start Dynamic Weather
execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";
 
 
#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"
 

 
The player_build in this compiles points to the merged one from my first post (I have not upgraded to the latest Snapbuild Pro yet).
 
My server is working fine with A Plot for Life and Snap Build Pro.
 
Note that anything built before installing A Plot for Life v2+ needs to be realigned to the system so saving the ownerPUID in the DB worldspace field and the sql to do that has been posted and is also linked to from the first post.
Link to comment
Share on other sites

Easy one first  :) .

 

Variables.sqf has it 

if(isNil "DZE_PlotPole") then {
DZE_PlotPole = [30,45];
};

The first number is the radius you can build in (i.e. you can build within a 30 mtr radius of the pole), the second is the closest you can build another plot pole (in the default case, 45 mtrs radius meaning there is no overlap).

 

You can override it in the init.sqf using the same variable (DZE_PlotPole=[]).

 

Thanks for the help but i beleive your incorrect i have that value changed and i'm sure that is x and y 

 

I ahve both at 120 and can still make another plot at 45m

 

Thanks

Link to comment
Share on other sites

Thanks for the help but i beleive your incorrect i have that value changed and i'm sure that is x and y 

 

I ahve both at 120 and can still make another plot at 45m

 

Thanks

 

Nope, I have it correct.

 

DZE_PlotPole = [30,45];

 

In player_build.sqf

_distance = DZE_PlotPole select 0;
_needText = localize "str_epoch_player_246";


if(_isPole) then {
    _distance = DZE_PlotPole select 1;
};

This means the first element of the array (DZE_PlotPole) is the radius from the cursortarget the player can build unless the cursortarget is a plot pole and then it is the second element in the array taken for the radius .

 

You most probably have it defined in more than one place in your mission folders.  Do a wingrep for DZE_PlotPole and see how many instances come up.

 

This is unless you have modified that code in the player_build.sqf and if so then all bets are off as to what it is doing  ;) .

Link to comment
Share on other sites

 

Yes, you are right, it can be very frustrating.

 

I also understand that Raymix has released an updated version of the snapbuild pro and as the merged file in my first post was merged with the original snap build pro player_build, that is probably not helping.

 

This is my compiles.sqf

/*
FUNCTION COMPILES
*/
//Player only
if (!isDedicated) then {
 
"filmic" setToneMappingParams [0.07, 0.31, 0.23, 0.37, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
 
BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie
player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them
fnc_usec_damageActions = compile preprocessFileLineNumbers "Custom\PlotForLifev2\fn_damageActions.sqf"; //Checks which actions for nearby casualty
fnc_inAngleSector = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inAngleSector.sqf"; //Checks which actions for nearby casualty
fnc_usec_selfActions = compile preprocessFileLineNumbers "Custom\PlotForLifev2\fn_selfActions.sqf"; //Checks which actions for self
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
player_temp_calculation = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_temperatur.sqf"; //Temperatur System //TeeChange
player_weaponFiredNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponFiredNear.sqf";
player_animalCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_animalCheck.sqf";
player_spawnCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
player_dumpBackpack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_dumpBackpack.sqf";
building_spawnLoot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnLoot.sqf";
building_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\building_spawnZombies.sqf";
dayz_spaceInterrupt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\dayz_spaceInterrupt.sqf";
player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.sqf"; //Runs when player fires. Alerts nearby Zeds depending on calibre && audial rating
player_harvest = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_harvest.sqf";
player_packTent = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_packTent.sqf";
player_packVault = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_packVault.sqf";
player_unlockVault = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_unlockVault.sqf";
 
player_removeObject = compile preprocessFileLineNumbers "Custom\PlotForLifev2\remove.sqf";
player_removeNearby =     compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_removeNearby.sqf";
 
player_removeTankTrap = {
//Object Array, Range, Error Message (@Skaronator)
[["Hedgehog_DZ"], 1,"STR_EPOCH_ACTIONS_14"] call player_removeNearby;
};
player_removeNet = {
[["DesertLargeCamoNet","ForestCamoNet_DZ","DesertLargeCamoNet_DZ","ForestLargeCamoNet_DZ"], 5,"str_epoch_player_8"] call player_removeNearby;
};
 
player_login = {
private ["_unit","_detail"];
_unit = _this select 0;
_detail = _this select 1;
if(_unit == getPlayerUID player) then {
player setVariable["publish",_detail];
};
};
 
player_unlockDoor = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";
player_changeCombo = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_changeCombo.sqf"; 
 
player_lockVault = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_lockVault.sqf";
player_updateGui = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_updateGui.sqf";
player_crossbowBolt = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_crossbowBolt.sqf";
player_music = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_music.sqf"; //Used to generate ambient music
player_death = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_death.sqf";
player_switchModel = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_switchModel.sqf";
player_checkStealth = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_checkStealth.sqf";
world_sunRise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_sunRise.sqf";
world_surfaceNoise = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_surfaceNoise.sqf";
player_humanityMorph = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityMorph.sqf";
player_throwObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_throwObject.sqf";
player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf";
player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf";
fn_gearMenuChecks = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_gearMenuChecks.sqf";
 
//Objects
object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf";
object_setpitchbank = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_setpitchbank.sqf";
object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
 
local_roadDebris = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_roadDebris.sqf";
 
//Zombies
zombie_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_findTargetAgent.sqf";
zombie_loiter = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_loiter.sqf"; //Server compile, used for loiter behaviour
zombie_generate = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\zombie_generate.sqf"; //Server compile, used for loiter behaviour
wild_spawnZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\wild_spawnZombies.sqf"; //Server compile, used for loiter behaviour
 
pz_attack = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\pzombie\pz_attack.sqf";
 
dog_findTargetAgent = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\dog_findTargetAgent.sqf";
 
//actions
player_countmagazines = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_countmagazines.sqf";
player_addToolbelt = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_addToolbelt.sqf";
player_copyKey = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_copyKey.sqf";
player_reloadMag = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_reloadMags.sqf";
player_loadCrate = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_loadCrate.sqf";
player_craftItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
player_tentPitch = compile preprocessFileLineNumbers "Custom\PlotForLifev2\tent_pitch.sqf";
player_vaultPitch = compile preprocessFileLineNumbers "Custom\PlotForLifev2\vault_pitch.sqf";
player_drink = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_drink.sqf";
player_eat = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_eat.sqf";
player_useMeds = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_useMeds.sqf";
player_fillWater = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\water_fill.sqf";
player_makeFire = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_makefire.sqf";
player_harvestPlant = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_harvestPlant.sqf";
player_goFishing = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_goFishing.sqf";
player_build = compile preprocessFileLineNumbers "Custom\PlotForLifev2\player_build.sqf";
player_wearClothes = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";
object_pickup = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\object_pickup.sqf";
player_flipvehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_flipvehicle.sqf";
player_sleep = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_sleep.sqf";
player_antiWall = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_antiWall.sqf";
player_deathBoard = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\list_playerDeathsAlt.sqf";
 
player_plotPreview = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_showPlotRadius.sqf";
player_upgradeVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_upgradeVehicle.sqf";
 
//ui
player_selectSlot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_selectSlot.sqf";
player_gearSync = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSync.sqf";
player_gearSet = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_gearSet.sqf";
ui_changeDisplay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_changeDisplay.sqf";
ui_gear_sound =             compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\ui_gear_sound.sqf";
 
//System
player_monitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_monitor.sqf";
player_spawn_1 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_1.sqf";
player_spawn_2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\player_spawn_2.sqf";
onPreloadStarted "dayz_preloadFinished = false;";
onPreloadFinished "dayz_preloadFinished = true;";
 
// helper functions
player_hasTools = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_hasTools.sqf";
player_checkItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_checkItems.sqf";
player_removeItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_removeItems.sqf";
//Trader ["Trader City Name",false,"enter"] - Trader City Name | Show Message | "enter" || "leave"
player_traderCity = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderCity.sqf";
 
// combination of check && remove items
player_checkAndRemoveItems = {
private ["_items","_b"];
_items = _this;
_b = _items call player_checkItems;
if (_ B) then {
_b = _items call player_removeItems;
};
_b
};
 
dayz_HungerThirst = {
dayz_hunger = dayz_hunger + (_this select 0);
dayz_thirst = dayz_thirst + (_this select 1);
};
 
epoch_totalCurrency = {
// total currency
_total_currency = 0;
{
_part =  (configFile >> "CfgMagazines" >> _x);
_worth =  (_part >> "worth");
if isNumber (_worth) then {
_total_currency = _total_currency + getNumber(_worth);
};
} count (magazines player);
_total_currency
};
 
epoch_itemCost = {
_trade_total = 0;
{
_part_in_configClass =  configFile >> "CfgMagazines" >> (_x select 0);
if (isClass (_part_in_configClass)) then {
_part_inWorth = (_part_in_configClass >> "worth");
if isNumber (_part_inWorth) then {
_trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
};
};
} count _this;
 
//diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
_trade_total
};
 
epoch_returnChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\epoch_returnChange.sqf";
// usage [["partinclassname",4]] call epoch_returnChange;
 
dayz_losChance = {
private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];
_agent = _this select 0;
_dis = _this select 1;
_maxDis = _this select 2;
// diag_log ("VAL:  " + str(_this));
_val = (_maxDis - _dis) max 0;
_maxExp = ((exp 2) * _maxDis);
_myExp = ((exp 2) * (_val)) / _maxExp;
_myExp = _myExp * 0.7;
_myExp
};
 
ui_initDisplay = {
private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"];
disableSerialization;
_display = uiNamespace getVariable 'DAYZ_GUI_display';
_control = _display displayCtrl 1204;
_control ctrlShow false;
if (!r_player_injured) then {
_ctrlBleed = _display displayCtrl 1303;
_ctrlBleed ctrlShow false;
};
if (!r_fracture_legs && !r_fracture_arms) then {
_ctrlFracture = _display displayCtrl 1203;
_ctrlFracture ctrlShow false;
};
_ctrlDogFoodBorder = _display displayCtrl 1501;
_ctrlDogFoodBorder ctrlShow false;
_ctrlDogFood = _display displayCtrl 1701;
_ctrlDogFood ctrlShow false;
 
_ctrlDogWaterBorder = _display displayCtrl 1502;
_ctrlDogWaterBorder ctrlShow false;
_ctrlDogWater = _display displayCtrl 1702;
_ctrlDogWater ctrlShow false
};
 
dayz_losCheck = {
private["_target","_agent","_cantSee"];
_target = _this select 0; // PUT THE PLAYER IN FIRST ARGUMENT!!!!
_agent = _this select 1;
_cantSee = true;
if (!isNull _target) then {
 
_tPos = visiblePositionASL _target;
_zPos = visiblePositionASL _agent;
 
_tPos set [2,(_tPos select 2)+1];
_zPos set [2,(_zPos select 2)+1];
 
if ((count _tPos > 0) && (count _zPos > 0)) then {
_cantSee = terrainIntersectASL [_tPos, _zPos];
if (!_cantSee) then {
_cantSee = lineIntersects [_tPos, _zPos, _agent, vehicle _target];
};
};
};
_cantSee
};
 
dayz_equipCheck = {
private ["_empty", "_needed","_diff","_success"];
_config = _this;
_empty = [player] call BIS_fnc_invSlotsEmpty;
_needed = [_config] call BIS_fnc_invSlotType;
_diff = [_empty,_needed] call BIS_fnc_vectorDiff;
 
_success = true;
{
if (_x > 0) then {_success = false};
} count _diff;
hint format["Config: %5\nEmpty: %1\nNeeded: %2\nDiff: %3\nSuccess: %4",_empty,_needed,_diff,_success,_config];
_success
};
 
vehicle_gear_count = {
private["_counter"];
_counter = 0;
{
_counter = _counter + _x;
} count _this;
_counter
};
 
player_tagFriendlyMsg = {
if(player == (_this select 0)) then {
cutText[(localize "str_epoch_player_2"),"PLAIN DOWN"];
};
};
 
player_serverModelChange = {
private["_object","_model"];
_object = _this select 0;
_model = _this select 1;
if (_object == player) then {
_model call player_switchModel;
};
};
 
player_guiControlFlash = {
private["_control"];
_control = _this;
if (ctrlShown _control) then {
_control ctrlShow false;
} else {
_control ctrlShow true;
};
};
 
gearDialog_create = {
private ["_i","_dialog"];
if (!isNull (findDisplay 106)) then {
(findDisplay 106) closeDisplay 0;
};
openMap false;
closeDialog 0;
if (gear_done) then {sleep 0.001;};
player action ["Gear", player];
if (gear_done) then {sleep 0.001;};
_dialog = findDisplay 106;
_i = 0;
while {isNull _dialog} do {//DO NOT CHANGE TO A FOR LOOP!
_i = _i + 1;
_dialog = findDisplay 106;
if (gear_done) then {sleep 0.001;};
if (_i in [100,200,299]) then {
closeDialog 0;
player action ["Gear", player];
};
if (_i > 300) exitWith {};
};
if (gear_done) then {sleep 0.001;};
_dialog = findDisplay 106;
if ((parseNumber(_this select 0)) != 0) then {
ctrlActivate (_dialog displayCtrl 157);
if (gear_done) then {
waitUntil {ctrlShown (_dialog displayCtrl 159)};
sleep 0.001;
};
};
_dialog
};
 
gear_ui_offMenu = {
private["_control","_parent","_menu"];
disableSerialization;
_control = _this select 0;
_parent = findDisplay 106;
if (!(_this select 3)) then {
for "_i" from 0 to 9 do {
_menu = _parent displayCtrl (1600 + _i);
_menu ctrlShow false;
};
_grpPos = ctrlPosition _control;
_grpPos set [3,0];
_control ctrlSetPosition _grpPos;
_control ctrlShow false;
_control ctrlCommit 0;
};
};
 
dze_surrender_off = {
player setVariable ["DZE_Surrendered", false, true];
DZE_Surrender = false;
};
 
gear_ui_init = {
private["_control","_parent","_menu","_dspl","_grpPos"];
disableSerialization;
_parent = findDisplay 106;
_control = _parent displayCtrl 6902;
for "_i" from 0 to 9 do {
_menu = _parent displayCtrl (1600 + _i);
_menu ctrlShow false;
};
_grpPos = ctrlPosition _control;
_grpPos set [3,0];
_control ctrlSetPosition _grpPos;
_control ctrlShow false;
_control ctrlCommit 0;
};
 
dayz_eyeDir = {
private["_vval","_vdir"];
_vval = (eyeDirection _this);
_vdir = (_vval select 0) atan2 (_vval select 1);
if (_vdir < 0) then {_vdir = 360 + _vdir};
_vdir
};
 
DZE_getModelName = {
_objInfo = toArray(str(_this));
_lenInfo = count _objInfo - 1;
_objName = [];
_i = 0;
// determine where the object name starts
{
if (58 == _objInfo select _i) exitWith {};
_i = _i + 1;
} count _objInfo;
_i = _i + 2; // skip the ": " part
for "_k" from _i to _lenInfo do {
_objName set [(count _objName), (_objInfo select _k)];
};
_objName = toLower(toString(_objName));
_objName
};
 
dze_isnearest_player = {
private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
if(!isNull _this) then {
_nearPlayers = _this nearEntities ["CAManBase", 12];
_playerNear = ({isPlayer _x} count _nearPlayers) > 1;
_notClosest = false;
if (_playerNear) then {
// check if another player is closer
_playerDistance = player distance _this;
{
if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
} count _nearPlayers;
};
} else {
_notClosest = false;
};
_notClosest
};
 
// trader menu code
if (DZE_ConfigTrader) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";
}else{
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuHive.sqf";
};
// recent murders menu code
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_murderMenu.sqf";
 
//This is still needed but the fsm should terminate if any errors pop up.
[] spawn {
        private["_timeOut","_display","_control1","_control2"];
        disableSerialization;
        _timeOut = 0;
        dayz_loadScreenMsg = "";
        diag_log "DEBUG: loadscreen guard started.";
        _display = uiNameSpace getVariable "BIS_loadingScreen";
        if (!isNil "_display") then {
                _control1 = _display displayctrl 8400;
                _control2 = _display displayctrl 102;
        };
if (!isNil "dayz_DisplayGenderSelect") then {
waitUntil {!dayz_DisplayGenderSelect};
};
 
        // 120 sec timeout (12000 * 0.01)
        while { _timeOut < 12000 } do {
            if (dayz_clientPreload && dayz_authed) exitWith { diag_log "PLOGIN: Login loop completed!"; };
            if (!isNil "_display") then {
                if ( isNull _display ) then {
                        waitUntil { !dialog; };
                        startLoadingScreen ["","RscDisplayLoadCustom"];
                        _display = uiNameSpace getVariable "BIS_loadingScreen";
                        _control1 = _display displayctrl 8400;
                        _control2 = _display displayctrl 102;
                };
 
                if ( dayz_loadScreenMsg != "" ) then {
                        _control1 ctrlSetText dayz_loadScreenMsg;
                        dayz_loadScreenMsg = "";
                };
 
                _control2 ctrlSetText format["%1",round(_timeOut*0.01)];
            };
 
            _timeOut = _timeOut + 1;
 
            if (_timeOut >= 12000) then {
                1 cutText [localize "str_player_login_timeout", "PLAIN DOWN"];
                sleep 10;
                endLoadingScreen;
                endMission "END1";
            };
 
            sleep 0.01;
        };
};
 
dayz_meleeMagazineCheck = {
                private["_meleeNum","_magType"];
                _magType =         ([] + getArray (configFile >> "CfgWeapons" >> _wpnType >> "magazines")) select 0;
                _meleeNum = ({_x == _magType} count magazines player);
                if (_meleeNum < 1) then {
                        player addMagazine _magType;
                };
        };
 
dayz_originalPlayer = player;
 
progressLoadingScreen 0.8;
};
 
//Both
BIS_fnc_selectRandom = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_selectRandom.sqf";
BIS_fnc_vectorAdd =         compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_vectorAdd.sqf";
BIS_fnc_halo =              compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_halo.sqf";
BIS_fnc_findNestedElement = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_findNestedElement.sqf";
BIS_fnc_param = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BIS_fnc\fn_param.sqf";
 
fnc_buildWeightedArray = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildWeightedArray.sqf"; //Checks which actions for nearby casualty
fnc_usec_damageVehicle = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerVehicle.sqf"; //Event handler run on damage
 
// object_vehicleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_vehicleKilled.sqf"; //Event handler run on damage
object_setHitServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHitServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_setFixServer = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setFixServer.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_getHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_getHit.sqf"; //gets the hit value for a HitPoint (i.e. HitLegs) against the selection (i.e. "legs"), returns the value
object_setHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_setHit.sqf"; //process the hit as a NORMAL damage (useful for persistent vehicles)
object_processHit = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_processHit.sqf"; //process the hit in the REVO damage system (records && sets hit)
object_delLocal = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_delLocal.sqf";
// object_cargoCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_cargoCheck.sqf"; //Run by the player || server to monitor changes in cargo contents
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf"; //Event handler run on damage
fnc_veh_ResetEH = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\veh_ResetEH.sqf"; //Initialize vehicle
// Vehicle damage fix
vehicle_handleDamage    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
vehicle_handleKilled    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
//fnc_vehicleEventHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\init\vehicle_init.sqf"; //Initialize vehicle
fnc_inString = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_inString.sqf";
fnc_isInsideBuilding = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding;
fnc_isInsideBuilding2 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding2.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding2;
fnc_isInsideBuilding3 = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_isInsideBuilding3.sqf"; //_isInside = [_unit,_building] call fnc_isInsideBuilding3;
dayz_zombieSpeak = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_speak.sqf"; //Used to generate random speech for a unit
vehicle_getHitpoints = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_getHitpoints.sqf";
local_gutObject = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObject.sqf"; //Generated on the server (|| local to unit) when gutting an object
local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf"; //When vehicle is local to unit perform locking vehicle
local_gutObjectZ = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_gutObjectZ.sqf"; //Generated on the server (|| local to unit) when gutting an object
local_zombieDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandlerZ.sqf"; //Generated by the client who created a zombie to track damage
local_eventKill = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_eventKill.sqf"; //Generated when something is killed
//player_weaponCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_weaponCheck.sqf"; //Run by the player || server to monitor whether they have picked up a new weapon
curTimeStr = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_curTimeStr.sqf";
player_medBandage = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBandaged.sqf";
player_medInject = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medInject.sqf";
player_medEpi = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medEpi.sqf";
player_medTransfuse = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medTransfuse.sqf";
player_medMorphine = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medMorphine.sqf";
player_breaklegs = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medBreakLegs.sqf";
player_medPainkiller = compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\publicEH\medPainkiller.sqf";
world_isDay = {if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {true} else {false}};
player_humanityChange = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_humanityChange.sqf";
spawn_loot = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot.sqf";
spawn_loot_small = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_loot_small.sqf";
// player_projectileNear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_projectileNear.sqf";
FNC_GetSetPos = { //DO NOT USE IF YOU NEED ANGLE COMPENSATION!!!!
private "_pos";
_thingy = _this select 0;
_pos = getPosASL _thingy;
if (surfaceIsWater _pos) then {
_thingy setPosASL _pos;
} else {
_thingy setPosATL (ASLToATL _pos);
};
};
FNC_GetPos = {
private "_pos";
if (isNil {_this select 0}) exitWith {[0,0,0]};
_thingy = _this select 0;
_pos = getPosASL _thingy;
if !(surfaceIsWater _pos) then {
_pos =  ASLToATL _pos;
};
_pos
};
local_setFuel = {
private["_qty","_vehicle"];
_vehicle = _this select 0;
_qty = _this select 1;
_vehicle setFuel _qty;
};
zombie_initialize = {
private ["_unit","_position"];
_unit = _this select 0;
if (isServer) then {
_unit addEventHandler ["local", {_this call zombie_findOwner}];
};
_id = _unit addeventhandler["HandleDamage", { _this call local_zombieDamage }];
_id = _unit addeventhandler["Killed", { [_this, "zombieKills"] call local_eventKill }];
};
 
dayz_EjectPlayer = {
// check if player in vehicle
        private ["_noDriver","_vehicle","_inVehicle"];
        _vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if(_inVehicle) then {
_noDriver = ((_vehicle emptyPositions "driver") > 0);
if (_noDriver && (speed _vehicle) != 0) then {
player action [ "eject", _vehicle];
};
};
};
 
player_sumMedical = {
private["_character","_wounds","_legs","_arms","_medical"];
_character = _this;
_wounds = [];
if (_character getVariable["USEC_injured",false]) then {
{
if (_character getVariable[_x,false]) then {
_wounds set [count _wounds,_x];
};
} count USEC_typeOfWounds;
};
_legs = _character getVariable ["hit_legs",0];
_arms = _character getVariable ["hit_arms",0];
_medical = [
_character getVariable["USEC_isDead",false],
_character getVariable["NORRN_unconscious", false],
_character getVariable["USEC_infected",false],
_character getVariable["USEC_injured",false],
_character getVariable["USEC_inPain",false],
_character getVariable["USEC_isCardiac",false],
_character getVariable["USEC_lowBlood",false],
_character getVariable["USEC_BloodQty",12000],
_wounds,
[_legs,_arms],
_character getVariable["unconsciousTime",0],
_character getVariable["messing",[0,0]]
];
_medical
};
 
//Server Only
if (isServer) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_server\init\server_functions.sqf";
} else {
eh_localCleanup = {};
};
 
if (!isDedicated) then {
/* Use command menu instead of scroll menu? (default = false) */
DZE_SNAP_PRO_USE_COMMAND_MENU = false;
 
DZE_SNAP_BUILD_NUMKEYS = [0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B];
 
snap_build = compile preprocessFileLineNumbers "custom\snap_pro\snap_build.sqf";
dayz_spaceInterrupt = compile preprocessFileLineNumbers "custom\snap_pro\dayz_spaceInterrupt.sqf";
};
 
initialized = true;

 
Here is my init.sqf

/*
For DayZ Epoch
Addons Credits: Jetski Yanahui by Kol9yN, Zakat, Gerasimow9, YuraPetrov, zGuba, A.Karagod, IceBreakr, Sahbazz
*/
diag_log text "Init.sqf starting";
 
startLoadingScreen ["","RscDisplayLoadCustom"];
cutText ["","BLACK OUT"];
enableSaving [false, false];
 
//REALLY IMPORTANT VALUES
dayZ_instance = 11; //The instance
dayzHiveRequest = [];
initialized = false;
dayz_previousID = 0;
 
DZEdebug = true;
 
DZE_BuildingLimit = 300;
DZE_StaticConstructionCount = 1;
 
//disable greeting menu 
player setVariable ["BIS_noCoreConversations", true];
//disable radio messages to be heard and shown in the left lower corner of the screen
enableRadio false;
// May prevent "how are you civillian?" messages from NPC
enableSentences false;
 
// DayZ Epoch config
spawnShoremode = 1; // Default = 1 (on shore)
spawnArea= 1500; // Default = 1500
 
MaxVehicleLimit = 300; // Default = 50
MaxDynamicDebris = 500; // Default = 100
dayz_MapArea = 14000; // Default = 10000
dayz_maxLocalZombies = 30; // Default = 30 
 
dayz_paraSpawn = false;
 
dayz_minpos = -1; 
dayz_maxpos = 16000;
 
dayz_sellDistance_vehicle = 10;
dayz_sellDistance_boat = 30;
dayz_sellDistance_air = 40;
 
dayz_maxAnimals = 5; // Default: 8
dayz_tameDogs = true;
DynamicVehicleDamageLow = 0; // Default: 0
DynamicVehicleDamageHigh = 100; // Default: 100
 
DZE_BuildOnRoads = false; // Default: False
 
EpochEvents = [["any","any","any","any",30,"crash_spawner"],["any","any","any","any",0,"crash_spawner"],["any","any","any","any",15,"supply_drop"]];
dayz_fullMoonNights = true;
 
diag_log text "Init.sqf Start call compiles.";
 
//Load in compiled functions
call compile preprocessFileLineNumbers "init\variables.sqf"; //Initilize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf"; //Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf"; //Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "init\compiles.sqf"; //Compile regular functions
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "server_traders.sqf"; //Compile trader configs
progressLoadingScreen 1.0;
 
diag_log text "Init.sqf Start call compiles.";
 
"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";
 
if (isServer) then {
 
diag_log text "Init.sqf Is Server start.";
 
call compile preprocessFileLineNumbers "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";
//Compile vehicle configs
 
// Add trader citys
_nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";
 
diag_log text "APlotForLife";
_serverMonitor = [] execVM "custom\APlotForLifev2.2.1\server_monitor.sqf";
diag_log format["[_serverMonitor: %1]",_serverMonitor];
 
diag_log text "Init.sqf Is Server End.";
};
 
if (!isDedicated) then {
//Conduct map operations
0 fadeSound 0;
waitUntil {!isNil "dayz_loadScreenMsg"};
dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
 
//Run the player monitor
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor = [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
 
//anti Hack
[] execVM "\z\addons\dayz_code\system\antihack.sqf";
 
//Lights
//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
 
};
 
#include "\z\addons\dayz_code\system\REsec.sqf"
 
//Start Dynamic Weather
execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";
 
 
#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"
 

 
The player_build in this compiles points to the merged one from my first post (I have not upgraded to the latest Snapbuild Pro yet).
 
My server is working fine with A Plot for Life and Snap Build Pro.
 
Note that anything built before installing A Plot for Life v2+ needs to be realigned to the system so saving the ownerPUID in the DB worldspace field and the sql to do that has been posted and is also linked to from the first post.

 

I got it working, both mods are working together perfectly, no problems with restart or anything, the problem was where I placed the snap compiles info in my main compiles, I placed it at the bottom like you have it and poof everything is working proper. Thanks again Rim, you are an awesome guy!

Link to comment
Share on other sites

I got it working, both mods are working together perfectly, no problems with restart or anything, the problem was where I placed the snap compiles info in my main compiles, I placed it at the bottom like you have it and poof everything is working proper. Thanks again Rim, you are an awesome guy!

 

NP.  Glad you finally got it working.

 

I have also put up a new version of the mod (v2.2.4).

 

The changes are 

 

Open the fn_selfactions.sqf file 

find

if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {

change to

if((_typeOfCursorTarget in DZE_LockableStorage) && _characterID != "0" && (player distance _cursorTarget < 3)) then {

That should fix the issues with players not getting the option to unlock legacy safes (i.e. safes placed before this mod was installed).

 

@StiflersM0M : If you wouldn't mind updating the install instructions or if you can PM me the text (i.e. with all the spoiler tags and text between them) then I will post it on the first page and maintain it from there onwards.

 

No more planned releases or bug fixes for v2.2.x now.  Working on getting it in to the core Epoch build.

Link to comment
Share on other sites

NP.  Glad you finally got it working.

 

I have also put up a new version of the mod (v2.2.4).

 

The changes are 

 

Open the fn_selfactions.sqf file 

find

if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {

change to

if((_typeOfCursorTarget in DZE_LockableStorage) && _characterID != "0" && (player distance _cursorTarget < 3)) then {

That should fix the issues with players not getting the option to unlock legacy safes (i.e. safes placed before this mod was installed).

 

@StiflersM0M : If you wouldn't mind updating the install instructions or if you can PM me the text (i.e. with all the spoiler tags and text between them) then I will post it on the first page and maintain it from there onwards.

 

No more planned releases or bug fixes for v2.2.x now.  Working on getting it in to the core Epoch build.

For sure i could send it to you via PM, but i think the code tags and so on would no be pasted..... but i will send it to you, if that doesnt work just make a link to the post number :)

Link to comment
Share on other sites

Just as an aside, is anyone else getting an issue where people randomly get red dots all over their map showing the locations of wrecks, rubbish and mineral veins?? It happens to me randomly, started when I installed P4L, and it happens for some of my players randomly, if they get it it will go away with relog or death. No clue how this could be happening lol.

Link to comment
Share on other sites

For sure i could send it to you via PM, but i think the code tags and so on would no be pasted..... but i will send it to you, if that doesnt work just make a link to the post number :)

 

Thanks, got it.  I had to take from the pastebin link in to notepad then in to the post and then put all the code boxes back in  :) .

 

I have also put spoiler tags around a lot of the first post to make it a lot easier to read.

Link to comment
Share on other sites

Just as an aside, is anyone else getting an issue where people randomly get red dots all over their map showing the locations of wrecks, rubbish and mineral veins?? It happens to me randomly, started when I installed P4L, and it happens for some of my players randomly, if they get it it will go away with relog or death. No clue how this could be happening lol.

 

Change DZEdebug = true; to DZEdebug = false; in the init.sqf file.

 

That should do it.

 

It is meant for debugging but seems to be a bit broken.  I get it randomly as well.

Link to comment
Share on other sites

you've got a typo in you're step-by-step guide:

fn_selfactions.sqf:

 

find:
if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {

you repeat the same line twice but they both say to replace with 2 different things

 

 

in the edits for     player_packVault.sqf

there is no such thing as 

 

_holder setVariable["CharacterID",_ownerID,true];

or

_holder setVariable ["OEMPos", _pos, true];

to find in the file and so I think thoes 2 edits are ment to be in the unlockvault section of the edit.

 

for player_build.sqf:
 

Find 2x:

_tmpbuilt setVariable ["CharacterID",_combination,true];

and add directly under it 2x:

_tmpbuilt setVariable ["ownerPUID",_playerUID,true];

it only comes up once.
 
 
in the edits for player_buildingmaint.sqf it is totally wrong, because none of the things you say to find come up so I assume it's for player_buildingDowngrade.sqf instead.
 
you also have no edits for player_lock vault
 
 
 
 
yeah and after all that I'm not able to get this thing working.
Link to comment
Share on other sites

 

you've got a typo in you're step-by-step guide:

fn_selfactions.sqf:

 

find:
if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {

you repeat the same line twice but they both say to replace with 2 different things

 

 

in the edits for     player_packVault.sqf

there is no such thing as 

 

_holder setVariable["CharacterID",_ownerID,true];

or

_holder setVariable ["OEMPos", _pos, true];

to find in the file and so I think thoes 2 edits are ment to be in the unlockvault section of the edit.

 

for player_build.sqf:

 

Find 2x:

_tmpbuilt setVariable ["CharacterID",_combination,true];

and add directly under it 2x:

_tmpbuilt setVariable ["ownerPUID",_playerUID,true];

it only comes up once.

 
 
in the edits for player_buildingmaint.sqf it is totally wrong, because none of the things you say to find come up so I assume it's for player_buildingDowngrade.sqf instead.

 

you also have no edits for player_lock vault
 
 
 
 
yeah and after all that I'm not able to get this thing working.

 

1. yes how i said it, theese line is 2x times in the fn_selfaction.sqf.

first time it is one line 529 2nd time its one line 554

2. yes you are right, should be in the unlockvault section

3. yes was my fail, the first line where you have to paste it directly under is called:

_tmpbuilt setVariable ["CharacterID",_combination,true];

the 2nd one where you have to paste the same directly under it is called:

_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];

4. exact you are right

i will edit the tutorial in 10-15 hrs

Link to comment
Share on other sites

players simply dont lost the ownership if they die.

Guess I never realized I lost ownership on death.  I have always came back to my base and everything was fine.  I do have decay off on my server though, not sure if that has anything to do with it.  Wondering if I need this script or not.

Link to comment
Share on other sites

Guess I never realized I lost ownership on death.  I have always came back to my base and everything was fine.  I do have decay off on my server though, not sure if that has anything to do with it.  Wondering if I need this script or not.

 

By default, when your character dies you get a new character which is not linked to anything you have built.  If you remove items previously built by a previous character then you can still do so but it takes twice as long with twice the risk of breaking tools.  You also cannot build in the same place without removing and replanting the plot pole.  Doing that does not change the ownership of the built items though, just that you can continue building in the newly placed plot poles radius.

 

This mod ties all the buildables to your player on that server and not the character (which changes on death).

Link to comment
Share on other sites

I have followed your instructions and installed the mod, however it's not working for me as I just built a plot pole, killed myself and returned only to find I cannot build as it doesn't recognise that there is a plot pole there within 30 metres. Is there any fixes for this? I followed exactly as your instructions specified and the plot pole for life is not working.

 

I also changed the plot pole boundaries and enabled the option however when I click on the option in game from the plot pole nothing happens??

 

Edit: I went onto your github and uploaded all of them files instead to my host. Everything is setup how it should be but I am now getting autentication erros when joining my server :S

 

The error my players and myself recieve are;

ERROR: Cannot Sync Character as no characterID"
Edited by EpiGamer
Link to comment
Share on other sites

 

I have followed your instructions and installed the mod, however it's not working for me as I just built a plot pole, killed myself and returned only to find I cannot build as it doesn't recognise that there is a plot pole there within 30 metres. Is there any fixes for this? I followed exactly as your instructions specified and the plot pole for life is not working.

 

I also changed the plot pole boundaries and enabled the option however when I click on the option in game from the plot pole nothing happens??

 

Edit: I went onto your github and uploaded all of them files instead to my host. Everything is setup how it should be but I am now getting autentication erros when joining my server :S

 

The error my players and myself recieve are;

ERROR: Cannot Sync Character as no characterID"

 

 

Hi,

 

Not sure what is going wrong for you.

 

Download from the dropbox link and extract as listed in the first posts "Vanilla install guide".

 

The instuctions under the section "Step by Step guide by StiflersM0M" have a few issues that StiflersM0M is working on correcting (see post ).

 

This mod has nothing to do with player logins.  If there is an error in the files modified then that may cause the file to abort and produce unpredictable results. 

 

Get an install in using the dropbox files and if it is still not working then let us know what errors you are getting in your client side RPT file.

Link to comment
Share on other sites

THis not working properly for me when using snap build pro green snap points don't show and i used the playerbuild provided in the OP?

 

Double check the player build against the latest version from Snap Build Pro as I believe Raymix has released an updated version (or two now).  Have a look at StiflersM0Ms instructions for the player build and try those on the new player_build from SBP.

 

@PryMary:  Will you be doing a merged player_build with the newer SnapBuildPro ?.

Link to comment
Share on other sites

@RimBlock, funny you should ask! I merged it last night with the latest Snap_Pro but I also implemented the admin build etc to it also so don't have a "clean" version. Give me an hour or so and I will merge one quickly for everyone. I am having no issues with Snap_Pro or P4L and the server / client (me) are now using the new steam patch - 1.63.125548 - I have placed a plot pole - commited suicide - respawned - went back to plot pole (still there and tied to me) and showed the plot boundry and continued building with items snapping.

 

If you want it all - P4L / Snap_Pro / Instant Admin Build / Instant Admin Upgrade - use this Player_Build.sqf: (Thanks go to @KamikazeXeX - For getting the admin insta-build working)

 

/*
	DayZ Base Building
	Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_helperColor","_objectHelper","_objectHelperDir","_objectHelperPos","_canDo",
"_location","_dir","_classname","_item","_hasRequiredTools","_missingT","_missingB","_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","_previewCounter","_requireplot","_objHupDiff","_objHDiff","_isLandFireDZ","_isTankTrap","_isNear2","_typeIsString","_isBuildAdmin","_needBuildItem","_hasbuilditems","_itemIn","_countIn","_qty","_missingQty","_textMissing","_removed","_tobe_removed_total","_removed_total","_ownerPUID", "_playerUID"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

// disallow building if too many objects are found within 30m
if((count ((getPosATL player) nearObjects ["All",30])) >= DZE_BuildingLimit) exitWith {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;
_isBuildAdmin = (getPlayerUID player) in WG_adminBuild;

_vehicle = vehicle player;
_inVehicle = (_vehicle != player);

_playerUID = getPlayerUID player;
//snap
helperDetach = false;
_canDo = (!r_drag_sqf and !r_player_unconscious);

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"];};

_typeIsString = ((typeName _this) == "STRING");
//diag_log format["Type is STRING: %1",_typeIsString];
if (_typeIsString) then {
	_item =	_this;
};
if (!_typeIsString) then {
	_item =	_this select 0;
};

// Need Near Requirements
_abort = false;
_distance = 10;
_reason = "";

if (_typeIsString) then {
	_needNear = 	getArray (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "neednearby");

	{
		switch(_x) do{
			case "fire":
			{
				_isNear = {inflamed _x} count (getPosATL player nearObjects _distance);
				if(_isNear == 0) then {
					_abort = true;
					_reason = "fire";
				};
			};
			case "workshop":
			{
				_isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
				if(_isNear == 0) then {
					_abort = true;
					_reason = "workshop";
				};
			};
			case "fueltank":
			{
				_isNear = count (nearestObjects [player, dayz_fuelsources, _distance]);
				_isNear2 = nearestObjects [player, dayz_fuelsources, _distance];
				if(_isNear == 0) then {
					_abort = true;
					_reason = "fuel tank";
					_distance = 30;
				};
			};
		};
	} forEach _needNear;


	if(_abort) exitWith {
		cutText [format[(localize "str_epoch_player_135"),_reason,_distance], "PLAIN DOWN"];
		DZE_ActionInProgress = false;
	};
};

if (_typeIsString) then {
	_classname = 	getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Build" >> "create");
	_classnametmp = _classname;
	_require =  getArray (configFile >> "cfgMagazines" >> _this >> "ItemActions" >> "Build" >> "require");
};
if (!_typeIsString) then {
	_classname = _this select 0;
	_classnametmp = _classname;
	_require = _this select 1;
};
_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");
};


if (!_typeIsString) then {
	_offset = _this select 3;
};
if (_typeIsString) then {
	_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 ["ownerPUID","0"];

	 // //diag_log format["Player_build start: [PlayerUID = %1]  [OwnerID = %2]", _playerUID, _ownerID];

	// check if friendly to owner
	if(_playerUID == _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		= 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"]; };

_missingT = "";
_missingB = "";
_hasRequiredTools = true;
_hasbuilditem = true;
if (!_isBuildAdmin) then {
	{
		//diag_log format["Testing for tool: %1",_x];
		_hastoolweapon = _x in weapons player;
		if(!_hastoolweapon) exitWith {_hasRequiredTools = false; _missingT = getText (configFile >> "cfgWeapons" >> _x >> "displayName");};
	} forEach _require;

	if (!_typeIsString && _hasRequiredTools) then {
		_needBuildItem = _this select 2;
		{
			_itemIn = _x select 0;
			_countIn = _x select 1;
			_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
			if(_qty < _countIn) exitWith { _missingB = getText(configFile >> "CfgMagazines" >> _itemIn >> "displayName"); _missingQty = (_countIn - _qty); _hasbuilditem = false;};
		} forEach _needBuildItem;
	};
	
	if (_typeIsString && _hasRequiredTools) then {
		_hasbuilditem = _this in magazines player;
	};
};
// Message If missing
if (!_hasRequiredTools) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_137"),_missingT] , "PLAIN DOWN"];};

if (!_typeIsString && !_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_146"),_missingQty, _missingB], "PLAIN DOWN"];};
if (_typeIsString && !_hasbuilditem) exitWith {DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"build"] , "PLAIN DOWN"]; };


//Proceed after item check
if (_hasRequiredTools && _hasbuilditem) then {

	_location = [0,0,0];
	_isOk = true;

	// get inital players position
	_location1 = getPosATL player;
	_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 = getPosATL _objectHelper;
	
	//cutText [(localize "str_epoch_player_45"), "PLAIN DOWN"];

	_objHDiff = 0;

if (isClass (missionConfigFile >> "SnapBuilding" >> _classname)) then {	
	["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
};
	
	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;
			if (helperDetach) then {
				_dir = -45;
			} else {
				_dir = 180;
			};
		};
		if (DZE_6) then {
			_rotate = true;
			DZE_6 = false;
			if (helperDetach) then {
				_dir = 45;
			} else {
				_dir = 0;
			};
		};
		
		if (DZE_F and _canDo) then {	
			if (helperDetach) then {
			_objectHelperDir = getDir _objectHelper; 
			_objectHelper attachTo [player];
			_objectHelper setDir _objectHelperDir-(getDir player);
			helperDetach = false;
			} else {
			_objectHelperPos = getPosATL _objectHelper;
			detach _objectHelper;			
			_objectHelper setPosATL _objectHelperPos;
			_objectHelperDir = getDir _objectHelper;
			_objectHelper setVelocity [0,0,0]; //fix sliding glitch
			helperDetach = true;
			};
			DZE_F = false;
		};

		if(_rotate) then {
			if (helperDetach) then {
				_objectHelperDir = getDir _objectHelper;
				_objectHelperPos = getPosATL _objectHelper;
				_objectHelper setDir _objectHelperDir+_dir;
				_objectHelper setPosATL _objectHelperPos;
			} else {
				_objectHelper setDir _dir;
				_objectHelper setPosATL _position;
				//diag_log format["DEBUG Rotate BUILDING POS: %1", _position];			
			};

		};

		if(_zheightchanged) then {
			if (!helperDetach) then {
			detach _objectHelper;
			};

			_position = getPosATL _objectHelper;

			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;
			};

			_objectHelper setDir (getDir _objectHelper);

			if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
				_position set [2,0];
			};

			_objectHelper setPosATL _position;

			//diag_log format["DEBUG Change BUILDING POS: %1", _position];

			if (!helperDetach) then {
			_objectHelper attachTo [player];
			};
		};

		sleep 0.5;

		_location2 = getPosATL player;

		if(DZE_5) exitWith {
			_isOk = false;
			detach _object;
			_dir = getDir _object;
			_position = getPosATL _object;
			//diag_log format["DEBUG BUILDING POS: %1", _position];
			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(_IsNearPlot == 0 && !_isPole) then {
			_findNearestPoles = nearestObjects [_objectHelper, ["Plastic_Pole_EP1_DZ"], 30];
			_nearestPole = _findNearestPoles select 0;
			_objectHelperPos = getPosATL _objectHelper;
			if (_objectHelperPos distance _nearestPole < 30) exitWith {
				_isOk = false; 
				_cancel = true;
				_reason = "You cannot enter plot pole area while building is in progress";
				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 || 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;
		};
	};

	//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;

		// Get position based on object
		_location = _position;

		if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
			_location set [2,0];
		};

		_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 && !_isBuildAdmin} 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;
			_animState = animationState player;
			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 (_isBuildAdmin) then {
			_isOk = false;
			_proceed = true;
		};

		if (_proceed) then {
		//diag_log "Proceed OK";
			_tobe_removed_total = 0;
			_removed_total = 0;
			_temp_removed_array = [];
			if (!_isBuildAdmin) then {
				//diag_log "Is Admin REMOVE NOT OK";
				if (_typeIsString) then {
					_tobe_removed_total = ([player,_item] call BIS_fnc_invRemove);
					_removed_total = _tobe_removed_total;
				};
				if (!_typeIsString) then {
					{
						_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 _needBuildItem;
				};
			} else {
				//diag_log "Is Admin REMOVE OK";
				_tobe_removed_total = 1;
				_removed_total = 1;
			};
			if((_tobe_removed_total == _removed_total) && (_removed_total >= 1)) then {
				//diag_log "Removed Item OK";
				cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];

				if (_isPole) then {
					[] spawn player_plotPreview;
				};

				_tmpbuilt setVariable ["OEMPos",_location,true];

				if(_lockable > 1) then {
					//diag_log "Is Lockable OK";
					_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];
					_tmpbuilt setVariable ["ownerPUID",_playerUID,true];


					PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_playerUID],_classname];
					//diag_log "Publish Lockable";
					publicVariableServer "PVDZE_obj_Publish";

					cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];


				} else {
					_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
					_tmpbuilt setVariable ["ownerPUID",_playerUID,true];
					
					// fire?
					if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
						_tmpbuilt spawn player_fireMonitor;
					} else {
						//diag_log "Publish Other";
						PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_playerUID],_classname];
						publicVariableServer "PVDZE_obj_Publish";
					};
				};
			} else {
				//diag_log "Remove Item NOT OK";
				deleteVehicle _tmpbuilt;
				cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
				{
					[player,_x] call BIS_fnc_invAdd;
				} forEach _temp_removed_array;				
			};

		} else {
			//diag_log "Proceed NOT OK";
			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 {
		//diag_log "Cancel is TRUE";
		deleteVehicle _tmpbuilt;
		cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
	};
};

DZE_ActionInProgress = false;

 

As stated I will merge a player_build with the recent Snap_Pro and P4L and post an edit to this one so as to avoid confusion.

 

EDIT:

 

Well that was easier than I thought:

 

/*
	DayZ Base Building
	Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_helperColor","_objectHelper","_objectHelperDir","_objectHelperPos","_canDo",
"_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","_ownerPUID","_playerUID"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_40") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

// disallow building if too many objects are found within 30m
if((count ((getPosATL player) nearObjects ["All",30])) >= DZE_BuildingLimit) exitWith {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);

_playerUID = getPlayerUID player;
//snap
helperDetach = false;
_canDo = (!r_drag_sqf and !r_player_unconscious);

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 (getPosATL player nearObjects _distance);
			if(_isNear == 0) then {
				_abort = true;
				_reason = "fire";
			};
		};
		case "workshop":
		{
			_distance = 3;
			_isNear = count (nearestObjects [player, ["Wooden_shed_DZ","WoodShack_DZ","WorkBench_DZ"], _distance]);
			if(_isNear == 0) then {
				_abort = true;
				_reason = "workshop";
			};
		};
		case "fueltank":
		{
			_distance = 30;
			_isNear = count (nearestObjects [player, 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 ["ownerPUID","0"];

	// diag_log format["Player_build start: [PlayerUID = %1]  [OwnerID = %2]", _playerUID, _ownerID];

	// check if friendly to owner
	if(_playerUID == _ownerID) then {  //Keep ownership
		// owner can build anything within his plot except other plots
		diag_log text "Player is owner";
		if(!_isPole) then {
			_canBuildOnPlot = true;
		};
	} else {
		// disallow building plot
		if(!_isPole) then {
			_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 = getPosATL player;
	_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 = getPosATL _objectHelper;
	
	//cutText [(localize "str_epoch_player_45"), "PLAIN DOWN"];

	_objHDiff = 0;

if (isClass (missionConfigFile >> "SnapBuilding" >> _classname)) then {	
	["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
};
	
	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;
			if (helperDetach) then {
				_dir = -45;
			} else {
				_dir = 180;
			};
		};
		if (DZE_6) then {
			_rotate = true;
			DZE_6 = false;
			if (helperDetach) then {
				_dir = 45;
			} else {
				_dir = 0;
			};
		};
		
		if (DZE_F and _canDo) then {	
			if (helperDetach) then {
			_objectHelperDir = getDir _objectHelper; 
			_objectHelper attachTo [player];
			_objectHelper setDir _objectHelperDir-(getDir player);
			helperDetach = false;
			} else {
			_objectHelperPos = getPosATL _objectHelper;
			detach _objectHelper;			
			_objectHelper setPosATL _objectHelperPos;
			_objectHelperDir = getDir _objectHelper;
			_objectHelper setVelocity [0,0,0]; //fix sliding glitch
			helperDetach = true;
			};
			DZE_F = false;
		};

		if(_rotate) then {
			if (helperDetach) then {
				_objectHelperDir = getDir _objectHelper;
				_objectHelperPos = getPosATL _objectHelper;
				_objectHelper setDir _objectHelperDir+_dir;
				_objectHelper setPosATL _objectHelperPos;
			} else {
				_objectHelper setDir _dir;
				_objectHelper setPosATL _position;
				//diag_log format["DEBUG Rotate BUILDING POS: %1", _position];			
			};

		};

		if(_zheightchanged) then {
			if (!helperDetach) then {
			detach _objectHelper;
			};

			_position = getPosATL _objectHelper;

			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;
			};

			_objectHelper setDir (getDir _objectHelper);

			if((_isAllowedUnderGround == 0) && ((_position select 2) < 0)) then {
				_position set [2,0];
			};

			_objectHelper setPosATL _position;

			//diag_log format["DEBUG Change BUILDING POS: %1", _position];

			if (!helperDetach) then {
			_objectHelper attachTo [player];
			};
		};

		sleep 0.5;

		_location2 = getPosATL player;

		if(DZE_5) exitWith {
			_isOk = false;
			detach _object;
			_dir = getDir _object;
			_position = getPosATL _object;
			//diag_log format["DEBUG BUILDING POS: %1", _position];
			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(_IsNearPlot == 0 && !_isPole) then {
			_findNearestPoles = nearestObjects [_objectHelper, ["Plastic_Pole_EP1_DZ"], 30];
			_nearestPole = _findNearestPoles select 0;
			_objectHelperPos = getPosATL _objectHelper;
			if (_objectHelperPos distance _nearestPole < 30) exitWith {
				_isOk = false; 
				_cancel = true;
				_reason = "You cannot enter plot pole area while building is in progress";
				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;
		};
	};

	//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;

		// Get position based on object
		_location = _position;

		if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then {
			_location set [2,0];
		};

		_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];
					_tmpbuilt setVariable ["ownerPUID",_playerUID,true];


					PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_playerUID],_classname];
					publicVariableServer "PVDZE_obj_Publish";

					cutText [format[(localize "str_epoch_player_140"),_combinationDisplay,_text], "PLAIN DOWN", 5];


				} else {
					_tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
					_tmpbuilt setVariable ["ownerPUID",_playerUID,true];
					
					// fire?
					if(_tmpbuilt isKindOf "Land_Fire_DZ") then {
						_tmpbuilt spawn player_fireMonitor;
					} else {
						PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_playerUID],_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;

 

For those not sure where to put this, it goes into the snap_pro directory in your custom folder (ONLY HAVE ONE PLAYER_BUILD FILE) then in your compiles.sqf point it to the snap_pro directory NOT PLOTFORLIFE (Sorry RimBlock).

 

 

Regards,

 

Pry

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...