Jump to content

[Outdated][1.6.1 RELEASE] WORKSHOP UPDATED


juandayz

Recommended Posts

Hi @juandayz I mentioned in my server thread earlier that I had altered the weapons spawned in the supply crate dropped from scanning the Workshop's antenna, but gave no details. The default traders on my server (who's price lists were stock 1.0.6) had different classes for some of the weapons in the crate so I changed lines 64-70 of craftfrecuency.sqf to:

//weapon lists
_weapon = "DMR_DZ";
_weapon2 = "AK74_DZ";
_weapon3 = "L85_Holo_DZ";
_weapon4 = "RPK74_DZ";
_weapon5 = "M14_DZ";
_weapon6 = "M249_DZ";

 

Link to comment
Share on other sites

for anyone who want to use @Grahame craftfrecuency.sqf weapons.. hers the whole code

Spoiler

private ["_playerPos","_nearantena","_LastUsedTime","_Time","_rand"];

_playerPos = getPosATL player;
_nearantena = count nearestObjects [_playerPos, ["MAP_parabola_big"], 45] > 0;
_LastUsedTime = 100;
_Time = time - lastpack;


if(_Time < _LastUsedTime) exitWith { // If cooldown is not done then exit script
    cutText [format["wait %1 before you can pickup another frequency!",(round(_Time - _LastUsedTime))], "PLAIN DOWN"]; 
dayz_actionInProgress = false;	
};

if !(_nearantena) exitWith {
	cutText [format["You need to be near an antenna."], "PLAIN DOWN"];
dayz_actionInProgress = false;	
	};
	
 
if (_nearantena) then {
lastpack = time;
_rand = floor(random 200);
			
if (_rand <= 20) then {
										

[format["<t align='center' size='0.75' color='#ff5200'>%1 Successfully picked up a frequency.</t>",(name player)],0,0,2,2] spawn BIS_fnc_dynamicText;
       
private ["_display","_distance","_boxtype","_unit","_getPos","_position","_box","_chute","_smoke","_var","_textt","_tools","_items","_weapon","_weapon2","_weapon3","_weapon4","_weapon5","_weapon6","_giveWep","_possibleMags","_mag","_whichBuild","_crateItems","_text"];



disableSerialization;
_display = findDisplay 24;
(_display) closeDisplay 0;

_distance = 500;
_boxtype = "USVehicleBox_EP1";
_unit = player;
_getPos = getPos _unit;
_position = [_getPos select 0, _getPos select 1, 25];
_box = _boxtype createVehicle _position;
_box setVariable ["Mission",1,true];
_box setVariable ["permaLoot",1,true];
_box setVariable ["ObjectID",""];
_chute = createVehicle ["ParachuteMediumEast", getPos _box, [], 0, "FLY"];
_box attachTo [_chute, [0,0,3]];
_smoke = "SmokeShellBlue" createVehicle (getPos _box);
_smoke attachTo [_box, [0,0,0]];
_var = floor((random 2) + 1);



//display text to alert user
_textt = format ["\nPackage from air!",10];
titleText [_textt,"PLAIN DOWN"];

//define items

_tools = ["ItemEtool","ItemKnife","ItemFishingPole","ItemHatchet_DZE","ItemMatchbox_DZE","ItemCrowbar"];
_items = ["ItemSodaPepsi","ItemMorphine","FoodNutmix","ItemBloodbag","FoodCanSardines","ItemKiloHemp"];


//weapon lists
_weapon = "DMR_DZ";
_weapon2 = "AK74_DZ";
_weapon3 = "L85_Holo_DZ";
_weapon4 = "RPK74_DZ";
_weapon5 = "M14_DZ";
_weapon6 = "M249_DZ";
_giveWep = [_weapon,_weapon2,_weapon3,_weapon4,_weapon5,_weapon6] call BIS_fnc_selectRandom;
_possibleMags = getArray (configfile >> "cfgWeapons" >> _giveWep >> "magazines");
_mag = _possibleMags select 0;

//select arrays to use
_crateItems = [_items] call BIS_fnc_selectRandom;
uisleep 1;

clearweaponcargoglobal _box;
clearmagazinecargoglobal _box;

uisleep 1;

{_box addMagazineCargoGlobal [_x, _var];} forEach _crateItems;
{_box addWeaponCargoGlobal [_x, 1];} forEach _tools;
_box addMagazineCargoGlobal [_mag, _var];
_box addWeaponCargoGlobal [_giveWep, 1];

uisleep 1;
dayz_actionInProgress = false;
waitUntil {(player distance _box) > _distance};
deleteVehicle _box;
deleteVehicle _chute;


}; 

if (_rand <= 200 && _rand > 21) then {
cutText[format["Thers no frecuency for the moment try later"], "PLAIN DOWN"];
dayz_actionInProgress = false;				
			};
};

	dayz_actionInProgress = false;	

 

 

Link to comment
Share on other sites

  • 2 weeks later...
8 hours ago, Schalldampfer said:

The building of Large house seems to be the same as Small house.

Is the true large house "MAP_deutshe_mini" ?

nice spot!  open upsmallhouse.sqf

find this line

_classname =  "MAP_bouda2_vnitrek";  

change by:

_classname =  "MAP_deutshe_mini";  

 

Link to comment
Share on other sites

On 3/4/2017 at 8:16 AM, Schalldampfer said:

I found a bug, "MAP_p_urtica" is lost in variables - DZE_workshop , this made my server failed in authentication

Just add it in workshop array (thus DZE_workshop) and the bug's solved

added the id into the main post steps. TNKS!!!

Link to comment
Share on other sites

I found another small bug

in sqfs\craftfrecuency.sqf ,
_box setVariable ["permaLoot",1,true];
must be
_box setVariable ["permaLoot",true];

and, there are also two old classnames
"ItemHatchet_DZE","ItemMatchbox_DZE"
in  _tools .

 

 

On ‎2015‎年‎3‎月‎9‎日 at 5:23 AM, ebayShopper said:

Looks like this is returning a number:


_keep = _x getVariable["permaLoot", false];

It should always return a boolean. That means one of your custom scripts is most likely using the permaLoot variable incorrectly. When you setVariable it the value should always be either true or false i.e.:


_object setVariable ["permaLoot",true];

One of your scripts is probably doing something like this by mistake:


_object setVariable ["permaLoot",1];

Now when it does getVariable on that object it will error because it is expecting a boolean but got a number. The easiest way to find the error would be to search your mission and server pbo for "permaLoot" and see if any of your scripts are setting it to a number.

Link to comment
Share on other sites

  • 2 weeks later...

There is still an huge issue in those files. Here's the fix for not being able to build herohospital:

In the files upherohospital.sqf, uplargehouse.sqf and upmiddlehouse.sqf replace the "cinder_wall_kit" with "full_cinder_wall_kit". That should fix the issue.
If you replaced all item names (should be like 6).

Link to comment
Share on other sites

On 20/4/2017 at 3:26 PM, DAmNRelentless said:

There is still an huge issue in those files. Here's the fix for not being able to build herohospital:

In the files upherohospital.sqf, uplargehouse.sqf and upmiddlehouse.sqf replace the "cinder_wall_kit" with "full_cinder_wall_kit". That should fix the issue.
If you replaced all item names (should be like 6).

Nice spot

also you can use half_cinder_wall_kit   to do it with a 1/3 of cinder wall.

or more realistic

_hasitem = [["itemTent",2],[ItemCanvas,2], "ItemPole"] call player_checkItems;

_removed = [["ItemTent",2],[ItemCanvas,2], "ItemPole"] call player_removeItems;

Link to comment
Share on other sites

3 hours ago, Kimarik said:

Hello. Is it possible to convert the "Smalhouse" into a garage, because I have problems to implement Alchemy Buildings.

I think the better way is use the deployanything mod to do it.... 

but yes you will need change id for the small house by the garage in upsmallhouse.sqf.

this line

_classname =  "MAP_deutshe_mini";  //change the id by the garage id.

now in this line change by the garage id again

_nearRestr = count nearestObjects [_playerPos, ["MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_bouda2_vnitrek"], 45] > 0;

2-In variables sqf.

this line: (change the line in red by your garage id)

Spoiler

//workshop

workshop = ["MAP_kulna","Land_Misc_Well_L_EP1","MAP_Misc_Boogieman","MAP_p_urtica","MAP_Shed_W01","MAP_P_Stavebni_kozy","MAP_parabola_big","MAP_office_table_a","Loudspeakers_EP1","MAP_Dkamna_bila","MAP_plot_green_draty","GUE_WarfareBFieldhHospital","MAP_bouda2_vnitrek","MAP_deutshe_mini","MAP_Mil_Mil_Guardhouse","MAP_Pristresek_mensi","Land_fort_bagfence_corner","MAP_plot_provizorni","M2StaticMG_US_EP1","DSHKM_Gue","SearchLight_RUS"];
 

3- open workshopmenu.hpp  and find this block

Spoiler

class AVRscButton_1610: jzRscButton
{
	idc = 1610;
	text = "SMALL HOUSE";
	x = 0.18314 * safezoneW + safezoneX;
	y = 0.592452 * safezoneH + safezoneY;
	w = 0.113245 * safezoneW;
	h = 0.0316161 * safezoneH;
	colorBackground[] = {0.1,0.1,0.1,0.8};
	OnButtonClick = "((ctrlParent (_this select 0)) closeDisplay 7002);ExecVM 'custom\workshop\sqfs\upsmallhouse.sqf';";
};

in text line.. change the name that you wanna show in display menu. for example put "CRAFT GARAGE"

 

Link to comment
Share on other sites

  • 4 weeks later...

I havnt been able to fully test this, but does the electric fence work on AIs? I;ve noticed ais can walk through bases. sometimes. Adding the electric fence would eliminate that if it works lol

Just curious

Link to comment
Share on other sites

4 hours ago, theduke said:

I havnt been able to fully test this, but does the electric fence work on AIs? I;ve noticed ais can walk through bases. sometimes. Adding the electric fence would eliminate that if it works lol

Just curious

only players and zeds,,but is possible electrify ai i guess... maybe if u change

 _findZeds = _pos2 nearEntities ["zZombie_Base", fence_area];

by

_findZeds = _pos2 nearEntities ["AllVehicles", fence_area];

Link to comment
Share on other sites

  • 2 months later...

I've started using this mod on my server, but come across a few issues, these being BE issues and getting kicks left right and center. Ive added the BE filters that are mentioned earlier in this topic but am getting quite a few kicks which are to do with "CloseDisplay". What is basically happening when you go into "Manage Workshop" if you click a selection you will get a few kicks, the main one being a script restriction 8. It seems to be two in particular that are affected CloseDisplay 7000 and CloseDisplay 7002, instead of making a filter for each individual kick that occurs I have added the following 2 lines to line 8 of my script filter (it may be a different line for other servers though but very unlikely). Anyway look for the line that is your "5 CloseDisplay" and add the following filters to the end:

Spoiler

!"((ctrlParent (_this select 0)) closeDisplay 7002" !"((ctrlParent (_this select 0)) closeDisplay 7000"

Im doing it this way so that its a "wildcard" filter. So that any possible kicks that occur containing these lines will be filtered and you wont get kicked for them.

Also I have noticed a problem when trying to construct building items, it may not be to do with this mod but am going to ask anyway. When I attempt to build a wall or floor at present using materials in my inventory, i get a message saying that I have to be within 3 meters of a workshop. This occurs even though im standing right next to it. Would anyone know why this is happening?

 

Link to comment
Share on other sites

  • 8 months later...
20 hours ago, JakeQue said:

@juandayz

The server seems to delete the deployables like CCTV cameras and staticss on restart, any ideas? I've followed ALL steps.

 

Also, players can purchase statics and it doesn't remove the items from their inventory. 

because it's for 1.0.6.1. The server don't save the object spawned by scripts for 1.0.6.1.
you need to edit somewhere of something in workshop*.rar to adpt new format.

I think you can see some logs in *.rpt (though it's not the format of common errors, instead, it appears in the style of a log)

Link to comment
Share on other sites

1 hour ago, Schalldampfer said:

because it's for 1.0.6.1. The server don't save the object spawned by scripts for 1.0.6.1.
you need to edit somewhere of something in workshop*.rar to adpt new format.

I think you can see some logs in *.rpt (though it's not the format of common errors, instead, it appears in the style of a log)

I thought as much, unfortunately, the server rpt throws me no errors :(

Link to comment
Share on other sites

11 minutes ago, JakeQue said:

I thought as much, unfortunately, the server rpt throws me no errors :(

it's throwing the error like "Server_PublishObj error: Wrong parameter format". (and it's not helping us so much)

 

I found a hint for fix:

On 1/18/2018 at 8:21 AM, ebayShopper said:

Object publish, delete and kill requests to the server need to include AuthKey now. You can see the new formats:

https://github.com/EpochModTeam/DayZ-Epoch/commit/42e0047

https://github.com/EpochModTeam/DayZ-Epoch/commit/eefcdf2

Old:

PVDZ_obj_Destroy = [_objectID,_objectUID,player];

New:

PVDZ_obj_Destroy = [_objectID,_objectUID,player,_object,dayz_authKey];

 

So you need to update any third party scripts that use those variables.


Server_(PublishObj|PublishVeh|SwapObj|UpdateObject), PVDZ_obj_(Destroy|Publish), PVDZ_veh_Save, PVDZE_obj_Swap, PVDZE_veh_(Publish2|Upgrade) or server_deleteObj

https://github.com/EpochModTeam/DayZ-Epoch/blob/master/CHANGE LOG 1.0.6.2.txt#L14

 

If you send the parameters in the wrong order then you will get errors like the one you posted. Also make sure server_deleteObj is updated to server_deleteObjDirect if used directly on the server.

 

Most third party scripts have already been updated for 1.0.6.2 with these changes, so make sure you are using the newest versions.

Link to comment
Share on other sites

Right guys, for updating this to 1.0.6.2 you need to replace 3 files. This will fix objects placed remaining after restart, and will fix removing the items from player when purchasing static weapons.

statics.sqf

Spoiler

//UPDATE BY YaMaOnToastLad - King Kong Overpoch
// use only whit DZE_permanentplot=true;


private ["_plotcheck","_cost","_coins","_playerPos","_nearRestr","_hastool","_hasitem","_removed","_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"];

//Check if building already in progress, exit if so.
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
dayz_actionInProgress = true;

_pos = [player] call FNC_GetPos;

_onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;

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

/////////////////////////////RESTRICT IF ANOTHER OBJET IS NEAR

_nearRestr = count nearestObjects [_pos, ["M2StaticMG","DSHKM_Gue","SearchLight_Gue"], 45] > 5;


if (_nearRestr) exitWith {
systemchat "CANNOT BUILD ANOTHER STATIC WEAPON HERE"; 
    dayz_actionInProgress = false;
    };


_nearpole = count nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], 50] < 1;


if (_nearpole)exitWith {
systemchat "CANNOT BUILD WITHOUT A PLOT POLE"; 
    dayz_actionInProgress = false;
    };
    
    
    
if !(_nearpole) then {
_canBuild = false;
_nearestPole = objNull;
_ownerID = 0;
_friendlies = [];


_plotcheck = [player, false] call FNC_find_plots;
_distance = DZE_PlotPole select 0;

_nearestPole = _plotcheck select 2;


    _ownerID = _nearestPole getVariable["CharacterID","0"];
    if (dayz_characterID == _ownerID) then {
        _canBuild = true;
    } else {
        if (DZE_permanentPlot) then {
            _buildcheck = [player, _nearestPole] call FNC_check_access;
            _isowner = _buildcheck select 0;
            _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3));
            if (_isowner || _isfriendly) then {
                _canBuild = true;
            };
        } else {
            _friendlies    = player getVariable ["friendlyTo",[]];
            if (_ownerID in _friendlies) then {
                _canBuild = true;
            };
        };
    };
};

if (!_canBuild) exitWith {systemchat "This is not your plot pole.";dayz_actionInProgress = false;};    
    
        
    
    

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;

DZE_updateVec = false;
DZE_memDir = 0;
DZE_memForBack = 0;
DZE_memLeftRight = 0;

call gear_ui_init;
closeDialog 1;

if (dayz_isSwimming) exitWith {dayz_actionInProgress = false; localize "str_player_26" call dayz_rollingMessages;};
if (_inVehicle) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;};
if (_onLadder) exitWith {dayz_actionInProgress = false; localize "str_player_21" call dayz_rollingMessages;};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;};

//////////////////////////////PUT YOUR OBJET ID BELLOW
_classname =  _this select 0;

        //////////////////////////////////////////////////##########MATERIALS NEEDED SECTION

    
if (_classname isKindOf "DSHKM_Gue") then {

_hasitem = [["ItemPole",4], ["PartGeneric",4],["ItemGoldBar",4]] call player_checkItems;

}else{
if (_classname isKindOf "M2StaticMG") then {

_hasitem = [["ItemPole",4], ["PartGeneric",4],["ItemGoldBar",4]] call player_checkItems;

}else{
if (_classname isKindOf "SearchLight_RUS") then {

_hasitem = [["ItemPole",4], ["PartGeneric",4],["ItemLightBulb",2]] call player_checkItems;
 
};
};
};

        //////////////////////////////////////////////////##########MATERIALS NEEDED SECTION

_hastools = ["ItemToolbox"] call player_hasTools;


if !(_hasitem) exitWith {dayz_actionInProgress = false;};
if !(_hastools) exitWith {dayz_actionInProgress = false;};

///////////////////////////////////////////////    
_classnametmp = _classname;
_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
    

    _lockable = 0; //default define if lockable not found in config file below
    if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then { //find out if item is lockable object
        _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable"); // 2=lockbox, 3=combolock, 4=safe
    };

    _isAllowedUnderGround = 1; //check if allowed to build under terrain
    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,2,1];

};

  

    _objectHelper = objNull;
    _isOk = true;
    _location1 = [player] call FNC_GetPos; // get inital players position
    _dir = getDir player; //required to pass direction when building

    // if ghost preview available use that instead
    if (_ghost != "") then {
        _classname = _ghost;
    };

    _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built

    

    _objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
    _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]];

    if (isClass (configFile >> "SnapBuilding" >> _classname)) then {    
        ["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
    };

    
        ["","","",["Init","Init",0]] spawn build_vectors;
    

    _objHDiff = 0;    
    _cancel = false;
    _reason = "";
    
    helperDetach = false;
    _canDo = (!r_drag_sqf and !r_player_unconscious);
    _position = [_objectHelper] call FNC_GetPos;

    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(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir - DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir - 45;
            };
        };
        if (DZE_6) then {
            _rotate = true;
            DZE_6 = false;
            if(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir + DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir + 45;
            };
        };
        
        if(DZE_updateVec) then{
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            DZE_updateVec = false;
        };
        
        if (DZE_F and _canDo) then {
            if (helperDetach) then {
                _objectHelper attachTo [player];
                DZE_memDir = DZE_memDir-(getDir player);
                helperDetach = false;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            } else {        
                _objectHelperPos = getPosATL _objectHelper;
                detach _objectHelper;            
                DZE_memDir = getDir _objectHelper;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
                _objectHelper setPosATL _objectHelperPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };

        if(_rotate) then {
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

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

            _position = [_objectHelper] call FNC_GetPos;

            if(_zheightdirection == "up") then {
                _position set [2,((_position select 2)+0.1)];
                _objHDiff = _objHDiff + 0.1;
            };
            if(_zheightdirection == "down") then {
                _position set [2,((_position select 2)-0.1)];
                _objHDiff = _objHDiff - 0.1;
            };

            if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHDiff = _objHDiff + 1;
            };
            if(_zheightdirection == "down_alt") then {
                _position set [2,((_position select 2)-1)];
                _objHDiff = _objHDiff - 1;
            };

            if(_zheightdirection == "up_ctrl") then {
                _position set [2,((_position select 2)+0.01)];
                _objHDiff = _objHDiff + 0.01;
            };
            if(_zheightdirection == "down_ctrl") then {
                _position set [2,((_position select 2)-0.01)];
                _objHDiff = _objHDiff - 0.01;
            };

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

            if (surfaceIsWater _position) then {
                _objectHelper setPosASL _position;
            } else {
                _objectHelper setPosATL _position;
            };

            if (!helperDetach) then {
            _objectHelper attachTo [player];
            };
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        uiSleep 0.5;

        _location2 = [player] call FNC_GetPos;
        _objectHelperPos = [_objectHelper] call FNC_GetPos;
        
        if(DZE_5) exitWith {
            _isOk = false;
            _position = [_object] call FNC_GetPos;
            detach _object;
            _dir = getDir _object;
            _vector = [(vectorDir _object),(vectorUp _object)];    
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(_location1 distance _location2 > 50) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
        
        if(_location1 distance _objectHelperPos > 50) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_TOO_FAR",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (player getVariable["combattimeout",0] >= diag_tickTime) 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 = localize "STR_EPOCH_PLAYER_46";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
    };
    
    _isOk = true;
    _proceed = false;
    _counter = 0;
    _location = [0,0,0];

    //No building on roads unless toggled
    if (!DZE_BuildOnRoads) then {
        if (isOnRoad _position) then { _cancel = true; _reason = localize "STR_EPOCH_BUILD_FAIL_ROAD"; };
    };

    // No building in trader zones
    if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };

    if(!_cancel) then {

        _classname = _classnametmp;

        // Start Build
        _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; //create actual object that will be published to database

        _tmpbuilt setdir _dir; //set direction inherited from passed args from control
        _tmpbuilt setVariable["memDir",_dir,true];

_pos = [player] call FNC_GetPos;
_nearpole = count nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], 20] < 1;
if (_nearpole)exitWith {
systemchat "CANNOT BUILD WITHOUT PLOT POLE."; 
    dayz_actionInProgress = false;
    };
        
        // Get position based on object
        _location = _position;

        if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then { //check Z axis if not allowed to build underground
            _location set [2,0]; //reset Z axis to zero (above terrain)
        };
        
        _tmpbuilt setVectorDirAndUp _vector;
        
        _buildOffset = [0,0,0];
        _vUp = _vector select 1;
        switch (_classname) do {
            case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
        };
        
        _location = [
            (_location select 0) - (_buildOffset select 0),
            (_location select 1) - (_buildOffset select 1),
            (_location select 2) - (_buildOffset select 2)
        ];
    
        if (surfaceIsWater _location) then {
            _tmpbuilt setPosASL _location;
            _location = ASLtoATL _location; //Database uses ATL
        } else {
            _tmpbuilt setPosATL _location;
        };

        format[localize "str_epoch_player_138",_text] call dayz_rollingMessages;

        

player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;

        //////////////////////////////////////////////////##########REMOVE OBJECTS SECTION


if (_classname isKindOf "DSHKM_Gue") then {

player removeMagazine "ItemPole";player removeMagazine "ItemPole";player removeMagazine "ItemPole";player removeMagazine "ItemPole"; player removeMagazine "PartGeneric";player removeMagazine "PartGeneric";player removeMagazine "PartGeneric";player removeMagazine "PartGeneric"; player removeMagazine "ItemGoldBar";player removeMagazine "ItemGoldBar";player removeMagazine "ItemGoldBar";player removeMagazine "ItemGoldBar";
}else{
    
if (_classname isKindOf "M2StaticMG") then {

player removeMagazine "ItemPole";player removeMagazine "ItemPole";player removeMagazine "ItemPole";player removeMagazine "ItemPole"; player removeMagazine "PartGeneric";player removeMagazine "PartGeneric";player removeMagazine "PartGeneric";player removeMagazine "PartGeneric"; player removeMagazine "ItemGoldBar";player removeMagazine "ItemGoldBar";player removeMagazine "ItemGoldBar";player removeMagazine "ItemGoldBar";
}else{

if (_classname isKindOf "SearchLight_RUS") then {

player removeMagazine "ItemPole";player removeMagazine "ItemPole";player removeMagazine "ItemPole";player removeMagazine "ItemPole"; player removeMagazine "PartGeneric";player removeMagazine "PartGeneric";player removeMagazine "PartGeneric";player removeMagazine "PartGeneric"; player removeMagazine "ItemLightBulb";player removeMagazine "ItemLightBulb";

};
};
};

        //////////////////////////////////////////////////##########REMOVE OBJECTS SECTION


player removeWeapon "ItemToolbox";

////////////////////////////////////////////////////////////////////////////////        
        _limit = 3; //times it takes to build by default

        if (DZE_StaticConstructionCount > 0) then { //if count is manually overridden inside init.sqf, use that instead, else use limits configured in config files
            _limit = DZE_StaticConstructionCount;
        }
        else {
            if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
                _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
            };
        };


        
                

                _tmpbuilt setVariable ["OEMPos",_location,true]; //store original location as a variable

                 //if not lockable item
                    
                    _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
                    
                        if (DZE_permanentPlot) then {
                        
                            _tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
                            _tmpbuilt setvariable ["tempveh",1,true];
                                _friendsArr = [[dayz_playerUID,toArray (name player)]];
                                _tmpbuilt setVariable ["plotfriends", _friendsArr, true];
                                PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,dayz_playerUID,_vector],_friendsArr,player,dayz_authKey];
                                publicVariableServer "PVDZ_obj_Publish";
                           
                    };
                
            } else { //if magazine was not removed, cancel publish
                deleteVehicle _tmpbuilt;
                localize "str_epoch_player_46" call dayz_rollingMessages;
            };

        

//by juandayz writed with base on modular_build.sqf

dayz_actionInProgress = false;

useful.sqf
 

Spoiler

//UPDATE BY YaMaOnToastLad - King Kong Overpoch

// use only whit DZE_permanentplot=true;


private ["_plotcheck","_cost","_coins","_playerPos","_nearRestr","_hastool","_hasitem","_removed","_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"];

//Check if building already in progress, exit if so.
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
dayz_actionInProgress = true;

_pos = [player] call FNC_GetPos;

_onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;

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


_nearpole = count nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], 50] < 1;


if (_nearpole)exitWith {
systemchat "CANNOT BUILD WITHOUT PLOT POLE."; 
    dayz_actionInProgress = false;
    };
    
    
    
if !(_nearpole) then {
_canBuild = false;
_nearestPole = objNull;
_ownerID = 0;
_friendlies = [];


_plotcheck = [player, false] call FNC_find_plots;
_distance = DZE_PlotPole select 0;

_nearestPole = _plotcheck select 2;


    _ownerID = _nearestPole getVariable["CharacterID","0"];
    if (dayz_characterID == _ownerID) then {
        _canBuild = true;
    } else {
        if (DZE_permanentPlot) then {
            _buildcheck = [player, _nearestPole] call FNC_check_access;
            _isowner = _buildcheck select 0;
            _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3));
            if (_isowner || _isfriendly) then {
                _canBuild = true;
            };
        } else {
            _friendlies    = player getVariable ["friendlyTo",[]];
            if (_ownerID in _friendlies) then {
                _canBuild = true;
            };
        };
    };
};

if (!_canBuild) exitWith {systemchat "Not your plot pole.";dayz_actionInProgress = false;};    
    
        
    
    

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;

DZE_updateVec = false;
DZE_memDir = 0;
DZE_memForBack = 0;
DZE_memLeftRight = 0;

call gear_ui_init;
closeDialog 1;

if (dayz_isSwimming) exitWith {dayz_actionInProgress = false; localize "str_player_26" call dayz_rollingMessages;};
if (_inVehicle) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;};
if (_onLadder) exitWith {dayz_actionInProgress = false; localize "str_player_21" call dayz_rollingMessages;};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;};

//////////////////////////////PUT YOUR OBJET ID BELLOW
_classname =  _this select 0;


if (_classname isKindOf "MAP_Shed_W01") then {

_nearRestr = count nearestObjects [_pos, ["MAP_Shed_W01"], 45] > 0;

}else{
if (_classname isKindOf "MAP_Dkamna_bila") then {

_nearRestr = count nearestObjects [_pos, ["MAP_Dkamna_bila"], 45] > 0;

}else{
if (_classname isKindOf "Land_Misc_Well_L_EP1") then {

_nearRestr = count nearestObjects [_pos, ["Land_Misc_Well_L_EP1"], 45] > 0;
 
}else{
if (_classname isKindOf "MAP_P_Stavebni_kozy") then {

_nearRestr = count nearestObjects [_pos, ["MAP_P_Stavebni_kozy"], 45] > 0;

}else{
if (_classname isKindOf "MAP_office_table_a") then {

_nearRestr = count nearestObjects [_pos, ["MAP_office_table_a"], 45] > 0; 
};
};
};
};
};

if (_nearRestr) exitWith {
systemchat "CANNOT BUILD ANOTHER BUILDABLE HERE"; 
    dayz_actionInProgress = false;
    };

//////////////////////////////////////////////////##########MATERIALS NEEDED SECTION

if (_classname isKindOf "MAP_Shed_W01") then {

_hasitem = [["PartWoodLumber",4],["PartWoodPlywood",4]] call player_checkItems;

}else{
if (_classname isKindOf "MAP_Dkamna_bila") then {

_hasitem = [["PartGeneric",4], "ItemPole","PartEngine"] call player_checkItems;

}else{
if (_classname isKindOf "Land_Misc_Well_L_EP1") then {

_hasitem = [["CinderBlocks",2], "PartWoodPlywood"] call player_checkItems;
 
}else{
if (_classname isKindOf "MAP_P_Stavebni_kozy") then {

_hasitem = [["PartWoodLumber",4], "PartWoodPlywood"] call player_checkItems;

}else{
if (_classname isKindOf "MAP_office_table_a") then {

_hasitem = [["PartWoodLumber",4], "PartWoodPlywood"] call player_checkItems;
};
};
};
};
};


    

        //////////////////////////////////////////////////##########MATERIALS NEEDED SECTION

_hastools = ["ItemToolbox"] call player_hasTools;


if !(_hasitem) exitWith {dayz_actionInProgress = false;};
if !(_hastools) exitWith {dayz_actionInProgress = false;};

///////////////////////////////////////////////    
_classnametmp = _classname;
_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
    

    _lockable = 0; //default define if lockable not found in config file below
    if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then { //find out if item is lockable object
        _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable"); // 2=lockbox, 3=combolock, 4=safe
    };

    _isAllowedUnderGround = 1; //check if allowed to build under terrain
    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,2,1];

};

  

    _objectHelper = objNull;
    _isOk = true;
    _location1 = [player] call FNC_GetPos; // get inital players position
    _dir = getDir player; //required to pass direction when building

    // if ghost preview available use that instead
    if (_ghost != "") then {
        _classname = _ghost;
    };

    _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built

    

    _objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
    _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]];

    if (isClass (configFile >> "SnapBuilding" >> _classname)) then {    
        ["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
    };

    
        ["","","",["Init","Init",0]] spawn build_vectors;
    

    _objHDiff = 0;    
    _cancel = false;
    _reason = "";
    
    helperDetach = false;
    _canDo = (!r_drag_sqf and !r_player_unconscious);
    _position = [_objectHelper] call FNC_GetPos;

    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(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir - DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir - 45;
            };
        };
        if (DZE_6) then {
            _rotate = true;
            DZE_6 = false;
            if(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir + DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir + 45;
            };
        };
        
        if(DZE_updateVec) then{
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            DZE_updateVec = false;
        };
        
        if (DZE_F and _canDo) then {
            if (helperDetach) then {
                _objectHelper attachTo [player];
                DZE_memDir = DZE_memDir-(getDir player);
                helperDetach = false;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            } else {        
                _objectHelperPos = getPosATL _objectHelper;
                detach _objectHelper;            
                DZE_memDir = getDir _objectHelper;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
                _objectHelper setPosATL _objectHelperPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };

        if(_rotate) then {
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

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

            _position = [_objectHelper] call FNC_GetPos;

            if(_zheightdirection == "up") then {
                _position set [2,((_position select 2)+0.1)];
                _objHDiff = _objHDiff + 0.1;
            };
            if(_zheightdirection == "down") then {
                _position set [2,((_position select 2)-0.1)];
                _objHDiff = _objHDiff - 0.1;
            };

            if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHDiff = _objHDiff + 1;
            };
            if(_zheightdirection == "down_alt") then {
                _position set [2,((_position select 2)-1)];
                _objHDiff = _objHDiff - 1;
            };

            if(_zheightdirection == "up_ctrl") then {
                _position set [2,((_position select 2)+0.01)];
                _objHDiff = _objHDiff + 0.01;
            };
            if(_zheightdirection == "down_ctrl") then {
                _position set [2,((_position select 2)-0.01)];
                _objHDiff = _objHDiff - 0.01;
            };

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

            if (surfaceIsWater _position) then {
                _objectHelper setPosASL _position;
            } else {
                _objectHelper setPosATL _position;
            };

            if (!helperDetach) then {
            _objectHelper attachTo [player];
            };
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        uiSleep 0.5;

        _location2 = [player] call FNC_GetPos;
        _objectHelperPos = [_objectHelper] call FNC_GetPos;
        
        if(DZE_5) exitWith {
            _isOk = false;
            _position = [_object] call FNC_GetPos;
            detach _object;
            _dir = getDir _object;
            _vector = [(vectorDir _object),(vectorUp _object)];    
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(_location1 distance _location2 > 50) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
        
        if(_location1 distance _objectHelperPos > 50) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_TOO_FAR",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (player getVariable["combattimeout",0] >= diag_tickTime) 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 = localize "STR_EPOCH_PLAYER_46";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
    };
    
    _isOk = true;
    _proceed = false;
    _counter = 0;
    _location = [0,0,0];

    //No building on roads unless toggled
    if (!DZE_BuildOnRoads) then {
        if (isOnRoad _position) then { _cancel = true; _reason = localize "STR_EPOCH_BUILD_FAIL_ROAD"; };
    };

    // No building in trader zones
    if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };

    if(!_cancel) then {

        _classname = _classnametmp;

        // Start Build
        _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; //create actual object that will be published to database

        _tmpbuilt setdir _dir; //set direction inherited from passed args from control
        _tmpbuilt setVariable["memDir",_dir,true];

_pos = [player] call FNC_GetPos;
_nearpole = count nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], 20] < 1;
if (_nearpole)exitWith {
systemchat "CANNOT BUILD WITHOUT PLOT POLE."; 
    dayz_actionInProgress = false;
    };
        
        // Get position based on object
        _location = _position;

        if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then { //check Z axis if not allowed to build underground
            _location set [2,0]; //reset Z axis to zero (above terrain)
        };
        
        _tmpbuilt setVectorDirAndUp _vector;
        
        _buildOffset = [0,0,0];
        _vUp = _vector select 1;
        switch (_classname) do {
            case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
        };
        
        _location = [
            (_location select 0) - (_buildOffset select 0),
            (_location select 1) - (_buildOffset select 1),
            (_location select 2) - (_buildOffset select 2)
        ];
    
        if (surfaceIsWater _location) then {
            _tmpbuilt setPosASL _location;
            _location = ASLtoATL _location; //Database uses ATL
        } else {
            _tmpbuilt setPosATL _location;
        };

        format[localize "str_epoch_player_138",_text] call dayz_rollingMessages;

        

player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;

        //////////////////////////////////////////////////##########REMOVE OBJECTS SECTION


if (_classname isKindOf "MAP_Shed_W01") then {

_removed = [["PartWoodLumber",4],["PartWoodPlywood",4]] call player_removeItems; 

}else{
if (_classname isKindOf "MAP_Dkamna_bila") then {

_removed = [["PartGeneric",4], "ItemPole","PartEngine"] call player_removeItems; 

}else{
if (_classname isKindOf "Land_Misc_Well_L_EP1") then {

_removed = [["CinderBlocks",2], "PartWoodPlywood"] call player_removeItems;  
 
}else{
if (_classname isKindOf "MAP_P_Stavebni_kozy") then {

_removed = [["PartWoodLumber",4], "PartWoodPlywood"] call player_removeItems; 

}else{
if (_classname isKindOf "MAP_office_table_a") then {
_removed = [["PartWoodLumber",4], "PartWoodPlywood"] call player_removeItems;  

};
};
};
};
};
        
        
        


        //////////////////////////////////////////////////##########REMOVE OBJECTS SECTION

////////////////////////////////////////////////////////////////////////////////        
        _limit = 3; //times it takes to build by default

        if (DZE_StaticConstructionCount > 0) then { //if count is manually overridden inside init.sqf, use that instead, else use limits configured in config files
            _limit = DZE_StaticConstructionCount;
        }
        else {
            if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
                _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
            };
        };


        
                

                _tmpbuilt setVariable ["OEMPos",_location,true]; //store original location as a variable

                 //if not lockable item
                    
                    _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
                    
                        if (DZE_permanentPlot) then {
                        
                            _tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
                            _tmpbuilt setvariable ["tempveh",1,true];
                                _friendsArr = [[dayz_playerUID,toArray (name player)]];
                                _tmpbuilt setVariable ["plotfriends", _friendsArr, true];
                                PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,dayz_playerUID,_vector],_friendsArr,player,dayz_authKey];
                                publicVariableServer "PVDZ_obj_Publish";
                           
                    };
                
            } else { //if magazine was not removed, cancel publish
                deleteVehicle _tmpbuilt;
                localize "str_epoch_player_46" call dayz_rollingMessages;
            };

        

//by juandayz writed with base on modular_build.sqf

dayz_actionInProgress = false;

cctv\craft.sqf

Spoiler

//UPDATE BY YaMaOnToastLad - King Kong Overpoch
// use only whit DZE_permanentplot=true;


private ["_plotcheck","_cost","_coins","_playerPos","_nearRestr","_hastool","_hasitem","_removed","_abort","_reason","_distance","_isNear","_lockable","_isAllowedUnderGround","_offset","_classname","_zheightdirection","_zheightchanged","_rotate","_objectHelperPos","_objectHelperDir","_objHDiff","_position","_isOk","_dir","_vector","_cancel","_location2","_buildOffset","_location","_limit","_started","_finished","_animState","_isMedic","_proceed","_counter","_dis","_sfx","_combination_1_Display","_combination_1","_combination_2","_combination_3","_combination","_combinationDisplay","_combination_4","_num_removed","_tmpbuilt","_vUp","_classnametmp","_text","_ghost","_objectHelper","_location1","_object","_helperColor","_canDo","_pos","_onLadder","_vehicle","_inVehicle","_needNear","_canBuild"];

//Check if building already in progress, exit if so.
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_40" call dayz_rollingMessages;};
dayz_actionInProgress = true;

_pos = [player] call FNC_GetPos;

_onLadder =    (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;

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

/////////////////////////////RESTRICT IF ANOTHER OBJET IS NEAR

_nearpole = count nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], 50] < 1;


if (_nearpole)exitWith {
systemchat "CANNOT BUILD WITHOUT PLOT POLE."; 
    dayz_actionInProgress = false;
    };

    

if !(_nearpole) then {
_canBuild = false;
_nearestPole = objNull;
_ownerID = 0;
_friendlies = [];


_plotcheck = [player, false] call FNC_find_plots;
_distance = DZE_PlotPole select 0;

_nearestPole = _plotcheck select 2;


    _ownerID = _nearestPole getVariable["CharacterID","0"];
    if (dayz_characterID == _ownerID) then {
        _canBuild = true;
    } else {
        if (DZE_permanentPlot) then {
            _buildcheck = [player, _nearestPole] call FNC_check_access;
            _isowner = _buildcheck select 0;
            _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3));
            if (_isowner || _isfriendly) then {
                _canBuild = true;
            };
        } else {
            _friendlies    = player getVariable ["friendlyTo",[]];
            if (_ownerID in _friendlies) then {
                _canBuild = true;
            };
        };
    };
};

if (!_canBuild) exitWith {systemchat "not your pole";dayz_actionInProgress = false;};    
    
    
    

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;

DZE_updateVec = false;
DZE_memDir = 0;
DZE_memForBack = 0;
DZE_memLeftRight = 0;

call gear_ui_init;
closeDialog 1;

if (dayz_isSwimming) exitWith {dayz_actionInProgress = false; localize "str_player_26" call dayz_rollingMessages;};
if (_inVehicle) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_42" call dayz_rollingMessages;};
if (_onLadder) exitWith {dayz_actionInProgress = false; localize "str_player_21" call dayz_rollingMessages;};
if (player getVariable["combattimeout",0] >= diag_tickTime) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_43" call dayz_rollingMessages;};

//////////////////////////////PUT YOUR OBJET ID BELLOW
_classname =  _this select 0;

if (_classname isKindOf "SmallTV") then {
_cost = 10000;
}else{


if (_classname isKindOf "Loudspeaker") then {
_cost = 20000;

};
};
_coins = player getVariable [Z_moneyVariable,0];


if (_coins < _cost) exitWith {
    cutText[format["You need %1 coins to build your surviellance system.",_cost], "PLAIN DOWN"];
     dayz_actionInProgress = false;
}; 

///////////////////////////////////////////////    
_classnametmp = _classname;
_text =         getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
_ghost = getText (configFile >> "CfgVehicles" >> _classname >> "ghostpreview");
    

    _lockable = 0; //default define if lockable not found in config file below
    if(isNumber (configFile >> "CfgVehicles" >> _classname >> "lockable")) then { //find out if item is lockable object
        _lockable = getNumber(configFile >> "CfgVehicles" >> _classname >> "lockable"); // 2=lockbox, 3=combolock, 4=safe
    };

    _isAllowedUnderGround = 1; //check if allowed to build under terrain
    if(isNumber (configFile >> "CfgVehicles" >> _classname >> "nounderground")) then {
        _isAllowedUnderGround = getNumber(configFile >> "CfgVehicles" >> _classname >> "nounderground");
    };

_offset =     getArray (configFile >> "CfgVehicles" >> _classname >> "offset");

if((count _offset) <= 0) then {
 
if (_classname isKindOf "SmallTV") then {
_offset = [0,2,1];
}else{
 
if (_classname isKindOf "Loudspeaker") then {
_offset = [0,2,1];
};
};
};

    _objectHelper = objNull;
    _isOk = true;
    _location1 = [player] call FNC_GetPos; // get inital players position
    _dir = getDir player; //required to pass direction when building

    // if ghost preview available use that instead
    if (_ghost != "") then {
        _classname = _ghost;
    };

    _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"]; //object preview, not an actual object that will be built

    

    _objectHelper = "Sign_sphere10cm_EP1" createVehicle [0,0,0];
    _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]];

    if (isClass (configFile >> "SnapBuilding" >> _classname)) then {    
        ["","","",["Init",_object,_classname,_objectHelper]] spawn snap_build;
    };

    
        ["","","",["Init","Init",0]] spawn build_vectors;
    

    _objHDiff = 0;    
    _cancel = false;
    _reason = "";
    
    helperDetach = false;
    _canDo = (!r_drag_sqf and !r_player_unconscious);
    _position = [_objectHelper] call FNC_GetPos;

    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(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir - DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir - 45;
            };
        };
        if (DZE_6) then {
            _rotate = true;
            DZE_6 = false;
            if(DZE_dirWithDegrees) then{
                DZE_memDir = DZE_memDir + DZE_curDegree;
            }else{
                DZE_memDir = DZE_memDir + 45;
            };
        };
        
        if(DZE_updateVec) then{
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            DZE_updateVec = false;
        };
        
        if (DZE_F and _canDo) then {
            if (helperDetach) then {
                _objectHelper attachTo [player];
                DZE_memDir = DZE_memDir-(getDir player);
                helperDetach = false;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
            } else {        
                _objectHelperPos = getPosATL _objectHelper;
                detach _objectHelper;            
                DZE_memDir = getDir _objectHelper;
                [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
                _objectHelper setPosATL _objectHelperPos;
                _objectHelper setVelocity [0,0,0]; //fix sliding glitch
                helperDetach = true;
            };
            DZE_F = false;
        };

        if(_rotate) then {
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

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

            _position = [_objectHelper] call FNC_GetPos;

            if(_zheightdirection == "up") then {
                _position set [2,((_position select 2)+0.1)];
                _objHDiff = _objHDiff + 0.1;
            };
            if(_zheightdirection == "down") then {
                _position set [2,((_position select 2)-0.1)];
                _objHDiff = _objHDiff - 0.1;
            };

            if(_zheightdirection == "up_alt") then {
                _position set [2,((_position select 2)+1)];
                _objHDiff = _objHDiff + 1;
            };
            if(_zheightdirection == "down_alt") then {
                _position set [2,((_position select 2)-1)];
                _objHDiff = _objHDiff - 1;
            };

            if(_zheightdirection == "up_ctrl") then {
                _position set [2,((_position select 2)+0.01)];
                _objHDiff = _objHDiff + 0.01;
            };
            if(_zheightdirection == "down_ctrl") then {
                _position set [2,((_position select 2)-0.01)];
                _objHDiff = _objHDiff - 0.01;
            };

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

            if (surfaceIsWater _position) then {
                _objectHelper setPosASL _position;
            } else {
                _objectHelper setPosATL _position;
            };

            if (!helperDetach) then {
            _objectHelper attachTo [player];
            };
            [_objectHelper,[DZE_memForBack,DZE_memLeftRight,DZE_memDir]] call fnc_SetPitchBankYaw;
        };

        uiSleep 0.5;

        _location2 = [player] call FNC_GetPos;
        _objectHelperPos = [_objectHelper] call FNC_GetPos;
        
        if(DZE_5) exitWith {
            _isOk = false;
            _position = [_object] call FNC_GetPos;
            detach _object;
            _dir = getDir _object;
            _vector = [(vectorDir _object),(vectorUp _object)];    
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(_location1 distance _location2 > 60) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_MOVED",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
        
        if(_location1 distance _objectHelperPos > 60) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_TOO_FAR",DZE_buildMaxMoveDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if(abs(_objHDiff) > DZE_buildMaxHeightDistance) exitWith {
            _isOk = false;
            _cancel = true;
            _reason = format[localize "STR_EPOCH_BUILD_FAIL_HEIGHT",DZE_buildMaxHeightDistance];
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };

        if (player getVariable["combattimeout",0] >= diag_tickTime) 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 = localize "STR_EPOCH_PLAYER_46";
            detach _object;
            deleteVehicle _object;
            detach _objectHelper;
            deleteVehicle _objectHelper;
        };
    };
    
    _isOk = true;
    _proceed = false;
    _counter = 0;
    _location = [0,0,0];

    //No building on roads unless toggled
    if (!DZE_BuildOnRoads) then {
        if (isOnRoad _position) then { _cancel = true; _reason = localize "STR_EPOCH_BUILD_FAIL_ROAD"; };
    };

    // No building in trader zones
    if(!canbuild) then { _cancel = true; _reason = format[localize "STR_EPOCH_PLAYER_136",localize "STR_EPOCH_TRADER"]; };

    if(!_cancel) then {

        _classname = _classnametmp;

        // Start Build
        _tmpbuilt = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"]; //create actual object that will be published to database

        _tmpbuilt setdir _dir; //set direction inherited from passed args from control
        _tmpbuilt setVariable["memDir",_dir,true];

_pos = [player] call FNC_GetPos;
_nearpole = count nearestObjects [_pos, ["Plastic_Pole_EP1_DZ"], 50] < 1;
if (_nearpole)exitWith {
systemchat "CANNOT BUILD WITHOUT PLOT POLE."; 
    dayz_actionInProgress = false;
    };
        
        // Get position based on object
        _location = _position;

        if((_isAllowedUnderGround == 0) && ((_location select 2) < 0)) then { //check Z axis if not allowed to build underground
            _location set [2,0]; //reset Z axis to zero (above terrain)
        };
        
        _tmpbuilt setVectorDirAndUp _vector;
        
        _buildOffset = [0,0,0];
        _vUp = _vector select 1;
        switch (_classname) do {
            case "MetalFloor_DZ": { _buildOffset = [(_vUp select 0) * .148, (_vUp select 1) * .148,0]; };
        };
        
        _location = [
            (_location select 0) - (_buildOffset select 0),
            (_location select 1) - (_buildOffset select 1),
            (_location select 2) - (_buildOffset select 2)
        ];
    
        if (surfaceIsWater _location) then {
            _tmpbuilt setPosASL _location;
            _location = ASLtoATL _location; //Database uses ATL
        } else {
            _tmpbuilt setPosATL _location;
        };

       // format[localize "str_epoch_player_138",_text] call dayz_rollingMessages;

        //////////////////////////////////////////////////##########START TO BUILD AND REMOVE OBJETS
player playActionNow "Medic";
[player,"repair",0,false,10] call dayz_zombieSpeak;
[player,10,true,(getPosATL player)] spawn player_alertZombies;
sleep 3;


player setVariable[Z_moneyVariable, (_coins - _cost), true];
titleText [format["You paid %1 coins for your survillance system.",_cost] , "PLAIN DOWN", 1];

////////////////////////////////////////////////////////////////////////////////        
        _limit = 3; //times it takes to build by default

        if (DZE_StaticConstructionCount > 0) then { //if count is manually overridden inside init.sqf, use that instead, else use limits configured in config files
            _limit = DZE_StaticConstructionCount;
        }
        else {
            if (isNumber (configFile >> "CfgVehicles" >> _classname >> "constructioncount")) then {
                _limit = getNumber(configFile >> "CfgVehicles" >> _classname >> "constructioncount");
            };
        };


        
                

                _tmpbuilt setVariable ["OEMPos",_location,true]; //store original location as a variable

                 //if not lockable item
                    
                    _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
                    
                        if (DZE_permanentPlot) then {
                            _tmpbuilt setVariable ["ownerPUID",dayz_playerUID,true];
                            
                                _friendsArr = [[dayz_playerUID,toArray (name player)]];
                                _tmpbuilt setVariable ["plotfriends", _friendsArr, true];
                                PVDZ_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,dayz_playerUID,_vector],_friendsArr,player,dayz_authKey];
                                publicVariableServer "PVDZ_obj_Publish";
                           
                    };
                
            } else { //if magazine was not removed, cancel publish
                deleteVehicle _tmpbuilt;
                localize "str_epoch_player_46" call dayz_rollingMessages;
            };

    

//by juandayz writed with base on modular_build.sqf

dayz_actionInProgress = false;
 

 

Link to comment
Share on other sites

On 12/9/2016 at 8:41 PM, juandayz said:

THIS IS OPTIONAL. IF U WANNA REMOVE AMMO FROM MOUNTED WEAPONS AFTER SERVER RESTART

A-open server_functions.sqf find:

  Hide contents

find:
server_sendToClient = compile preprocessFileLineNumbers "\z\addons\dayz_server\eventHandlers\server_sendToClient.sqf";
add bellow
//Fnc removing workshop ammo
fnc_wra =                compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_wra.sqf";

 

B-OPEN THIS 3 FILES AND MAKE THE SAME CHANGES FOR EACH ONE.

server_monitor.sqf // server_publishVehicle2.sqf // server_publishVehicle3.sqf

  Hide contents

Find:

clearWeaponCargoGlobal  _object;

Paste Above:

//weaponworkshop remove ammo
call fnc_wra;
//weaponworkshop remove ammo

 

C-Now create "fnc_wra.sqf" and drop  into  ....\@DayZ_Epoch_Server\addons\dayz_server\compile\

Done. You can repack your dayz_server.pbo.

fnc_wra.sqf

  Hide contents

//workshop remove ammo
{
    
    if (_object isKindof "DSHKM_Gue") then {
         _object setVehicleAmmo 0;
        
    };

    if (_object isKindof "M2StaticMG_US_EP1") then {
         _object setVehicleAmmo 0;
         _ownerID = "0";
    };    
    
} forEach vehicles;    

 

D-In your \MPMissions\DayZ_Epoch_11.Chernarus\custom\workshop\sqfs\

make the same change for this two files:
updshkm.sqf // upm2.sqf

  Reveal hidden contents

 (upshkm.sqf)

find:

cutText [format["YOU FEEL LIKE COMUNIST RAMBO"], "PLAIN DOWN",3];

change by:

cutText [format["WARNING AMMO WILL BE REMOVED AFTER RESTART"], "PLAIN DOWN",3];

 (upm2.sqf)

find:

cutText [format["YOU FEEL LIKE RAMBO"], "PLAIN DOWN",3];

change by:

cutText [format["WARNING AMMO WILL BE REMOVED AFTER RESTART"], "PLAIN DOWN",3];

 

 

This most definitely does not work. 
 

Spoiler

18:04:55 Error in expression <e && !_isTrapItem) then {

call fnc_wra;

clearWeaponCargoGlobal _object;
cle>
18:04:55   Error position: <

clearWeaponCargoGlobal _object;
cle>
18:04:55   Error Invalid number in expression
18:04:55 File z\addons\dayz_server\system\server_monitor.sqf, line 240
18:04:55 Error in expression <e && !_isTrapItem) then {

call fnc_wra;

clearWeaponCargoGlobal _object;
cle>
18:04:55   Error position: <

clearWeaponCargoGlobal _object;

 

Link to comment
Share on other sites

Yeah, that is not necessary. Doing that will add a shitload of time to your server startup. The only file you have to modify is server_monitor.sqf.

Find this line:

https://github.com/EpochModTeam/DayZ-Epoch/blob/master/SQF/dayz_server/system/server_monitor.sqf#L280

Add this above it:

// Remove ammo from static weapons on restart
if (_object isKindOf "StaticWeapon") then {
	_object setVehicleAmmo 0;
};

 

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...