Jump to content

[Release] Build Vectors - Rotate objects in Dayz Epoch (v2.34 P4L & non-P4L)


striker

Recommended Posts

hi guys , sorry for the bad english . In error log .

16:46:40 Error in expression <n;

_vecCnt = 0;
{
_set = _x;
{
_vecCnt = _vecCnt + (round (_x * 100))

} count >
16:46:40   Error position: <= _vecCnt + (round (_x * 100))

} count >
16:46:40   Error Type Number, expected Bool
16:46:40 File z\addons\dayz_server\init\server_functions.sqf, line 625

My server_function: http://pastebin.com/BpDqYYMv

 

Help please

Link to comment
Share on other sites

hi guys , sorry for the bad english . In error log .

16:46:40 Error in expression <n;

_vecCnt = 0;
{
_set = _x;
{
_vecCnt = _vecCnt + (round (_x * 100))

} count >
16:46:40   Error position: <= _vecCnt + (round (_x * 100))

} count >
16:46:40   Error Type Number, expected Bool
16:46:40 File z\addons\dayz_server\init\server_functions.sqf, line 625

My server_function: http://pastebin.com/BpDqYYMv

 

Help please

 

 

Hey,

 

That is a common error that I need to sort out, script should still work as expected.

 

striker

Link to comment
Share on other sites

also it seems you got error on client RPT

Error in expression <Array = [_cancel,_reason,_position,_dir,_vector];
_passArray 
>
  Error position: <_vector];
_passArray 
>
  Error Undefined variable in expression: _vector
File mpmissions\__CUR_MP.Napf\dayz_code\actions\player_build_controls.sqf, line 224
Error in expression <text, _isPole, _lockable,_dir, _reason, _vector] call player_build_publish;
};
}>
  Error position: <_vector] call player_build_publish;
};
}>
  Error Undefined variable in expression: _vector
File mpmissions\__CUR_MP.Napf\dayz_code\actions\modular_build.sqf, line 91

Link to comment
Share on other sites

hi striker 

i am still haveing trouble 

 i did a new install  as per iinstructions  a new   A Plot for Life v2.34 with no server_monitor

i did all your updates 

i put down plot pole then build a V with 2 metal floors  and re started server, floors went flat no V

my code in db are 

 

356 171796824661847 13 MetalFloor_DZ 2014-12-14 12:16:41 2014-12-14 12:16:41 1 [47.443,[17179.6,8246.57,1.778],"76561198030386431",[[0.737,0.676,0],[0.478,-0.521,0.707]]] [] [] 0 0
355 171823824372047 13 MetalFloor_DZ 2014-12-14 12:15:44 2014-12-14 12:15:44 1 [47.443,[17182.3,8243.66,1.998],"76561198030386431",[[0.737,0.676,0],[-0.478,0.521,0.707]]] [] [] 0 0
354 17174682466041 13 Plastic_Pole_EP1_DZ 2014-12-14 12:14:28 2014-12-14 12:14:28 1 [40.947,[17174.6,8246.65,0],"76561198030386431",[[0.655,0.755,0],[0,0,1]]] [] [] 0 0
 
 
i am at a lost where to find why its not saveing in the V
thanks 
scottnkc
Link to comment
Share on other sites

Don't know if anyone knows a fix for this.

 

We found a way for players to "dupe" building objects, here's the process.

 

One player starts building, he gets the preview floor/wall up, he then goes into his inventory, drops the wall/floor and his friend picks it up, the player who is building then proceeds to finishing the wall/floor without using it up since his friend picked up the wall that the building player dropped. 

 

Don't know if i explained it good enough but does anyone know a fix?

Link to comment
Share on other sites

Don't know if anyone knows a fix for this.

 

We found a way for players to "dupe" building objects, here's the process.

 

One player starts building, he gets the preview floor/wall up, he then goes into his inventory, drops the wall/floor and his friend picks it up, the player who is building then proceeds to finishing the wall/floor without using it up since his friend picked up the wall that the building player dropped. 

 

Don't know if i explained it good enough but does anyone know a fix?

 

Pretty sure the default building system removed the item when the object is placed and if no item is found in inventory it cancels.

Link to comment
Share on other sites

anybody getting not setup yet errors? when upgrading a garage door to a locked one

 

Hey,

 

Just a hint to where that is occuring in player_upgrade.sqf. Similar in player_buildingDowngrade:

if(_objectID == "0" && _objectUID == "0") exitWith {DZE_ActionInProgress = false; s_player_upgrade_build = -1; cutText [(localize "str_epoch_player_50"), "PLAIN DOWN"];};

Can I see your server_monitor.sqf?

 

striker

Link to comment
Share on other sites

Server_moniter.sqf

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

dayz_versionNo =         getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo =     getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");

_hiveLoaded = false;

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)
    
// Custom Configs
if(isnil "MaxVehicleLimit") then {
    MaxVehicleLimit = 50;
};

if(isnil "MaxDynamicDebris") then {
    MaxDynamicDebris = 100;
};
if(isnil "MaxAmmoBoxes") then {
    MaxAmmoBoxes = 3;
};
if(isnil "MaxMineVeins") then {
    MaxMineVeins = 50;
};
// Custon Configs End

if (isServer && isNil "sm_done") then {
    
    PVDZE_Z_LoadMessage = ["Para-droping Your Character"];
    publicVariable "PVDZE_Z_LoadMessage";
    serverVehicleCounter = [];
    _hiveResponse = [];

    for "_i" from 1 to 5 do {
        diag_log "HIVE: trying to get objects";
        _key = format["CHILD:302:%1:", dayZ_instance];
        _hiveResponse = _key call server_hiveReadWrite;  
        if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {
            if ((_hiveResponse select 1) == "Instance already initialized") then {
                _superkey = profileNamespace getVariable "SUPERKEY";
                _shutdown = format["CHILD:400:%1:", _superkey];
                _res = _shutdown call server_hiveReadWrite;
                diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));
            } else {
                diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));
            
            };
            _hiveResponse = ["",0];
        }
        else {
            diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );
            _i = 99; // break
        };
    };
    
    _BuildingQueue = [];
    _objectQueue = [];
    
    if ((_hiveResponse select 0) == "ObjectStreamStart") then {
    
        // save superkey
        profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];
        
        _hiveLoaded = true;
    
        diag_log ("HIVE: Commence Object Streaming...");
        _key = format["CHILD:302:%1:", dayZ_instance];
        _objectCount = _hiveResponse select 1;
        _bQty = 0;
        _vQty = 0;
        for "_i" from 1 to _objectCount do {
            _hiveResponse = _key call server_hiveReadWriteLarge;
            //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);
            if ((_hiveResponse select 2) isKindOf "ModularItems") then {
                _BuildingQueue set [_bQty,_hiveResponse];
                _bQty = _bQty + 1;
            } else {
                _objectQueue set [_vQty,_hiveResponse];
                _vQty = _vQty + 1;
            };
        };
        diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
    };
    
    // # NOW SPAWN OBJECTS #
    _ammountOfObject = count (_BuildingQueue + _objectQueue);     
    _theMessage = format ["Spawning %1 Base objects and vehicles", _ammountOfObject];
    PVDZE_Z_LoadMessage = [_theMessage];
    publicVariable "PVDZE_Z_LoadMessage";
        _currentCount = 0;
        _newMileStone = 50;
    _totalvehicles = 0;
    {
        _idKey =         _x select 1;
        _type =            _x select 2;
        _ownerID =         _x select 3;

        _worldspace =     _x select 4;
        _inventory =    _x select 5;
        _hitPoints =    _x select 6;
        _fuel =            _x select 7;
        _damage =         _x select 8;
        
        _dir = 0;
        _pos = [0,0,0];
        _wsDone = false;
        if (count _worldspace >= 2) then
        {
            if ((typeName (_worldspace select 0)) == "STRING") then {
                _worldspace set [0, call compile (_worldspace select 0)];
                _worldspace set [1, call compile (_worldspace select 1)];
            };
            
            _dir = _worldspace select 0;
            if (count (_worldspace select 1) == 3) then {
                _pos = _worldspace select 1;
                _wsDone = true;
            }
        };            
        
        if (!_wsDone) then {
            if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
            _pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
            if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
            diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
        };
        
        _vector = [[0,0,0],[0,0,0]];
        _vecExists = false;
        _ownerPUID = "0";   
        if (count _worldspace >= 3) then{
            if(count _worldspace == 3) then{
                    if(typename (_worldspace select 2) == "STRING")then{
                        _ownerPUID = _worldspace select 2;
                    }else{
                         if(typename (_worldspace select 2) == "ARRAY")then{
                            _vector = _worldspace select 2;
                            if(count _vector == 2)then{
                                if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
                                    _vecExists = true;
                                };
                            };
                        };                  
                    };

            }else{
                //Was not 3 elements, so check if 4 or more
                if(count _worldspace == 4) then{
                    if(typename (_worldspace select 3) == "STRING")then{
                        _ownerPUID = _worldspace select 3;
                    }else{
                        if(typename (_worldspace select 2) == "STRING")then{
                            _ownerPUID = _worldspace select 2;
                        };
                    };


                    if(typename (_worldspace select 2) == "ARRAY")then{
                        _vector = _worldspace select 2;
                        if(count _vector == 2)then{
                            if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
                                _vecExists = true;
                            };
                        };
                    }else{
                        if(typename (_worldspace select 3) == "ARRAY")then{
                            _vector = _worldspace select 3;
                            if(count _vector == 2)then{
                                if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
                                    _vecExists = true;
                                };
                            };
                        };
                    };

                }else{
                    //More than 3 or 4 elements found
                    //Might add a search for the vector, ownerPUID will equal 0
                };
            };
        };
        
        if (_damage < 1) then {
            //diag_log format["OBJ: %1 - %2", _idKey,_type];
            
            //Create it
            _object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
            if (typeOf (_object) in  DZE_DoorsLocked) then {
                _object setVariable ["doorfriends", _inventory, true];
            };
            _object setVariable ["lastUpdate",time];
            _object setVariable ["ObjectID", _idKey, true];
            if (typeOf (_object) == "Plastic_Pole_EP1_DZ") then {
            _object setVariable ["plotfriends", _inventory, true];
            };
            _object setVariable ["ownerPUID", _ownerPUID, true];

            _lockable = 0;
            if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
                _lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
            };

            // fix for leading zero issues on safe codes after restart
            if (_lockable == 4) then {
                _codeCount = (count (toArray _ownerID));
                if(_codeCount == 3) then {
                    _ownerID = format["0%1", _ownerID];
                };
                if(_codeCount == 2) then {
                    _ownerID = format["00%1", _ownerID];
                };
                if(_codeCount == 1) then {
                    _ownerID = format["000%1", _ownerID];
                };
            };

            if (_lockable == 3) then {
                _codeCount = (count (toArray _ownerID));
                if(_codeCount == 2) then {
                    _ownerID = format["0%1", _ownerID];
                };
                if(_codeCount == 1) then {
                    _ownerID = format["00%1", _ownerID];
                };
            };

            _object setVariable ["CharacterID", _ownerID, true];
            
            clearWeaponCargoGlobal  _object;
            clearMagazineCargoGlobal  _object;
            // _object setVehicleAmmo DZE_vehicleAmmo;
            
            _object setdir _dir;
            if(_vecExists)then{
                _object setVectorDirAndUp _vector;
            };
            _object setposATL _pos;
            _object setDamage _damage;
            
            if ((typeOf _object) in indestructible) then {
                _object addEventHandler ["HandleDamage", {false}];
                _object enableSimulation false;
            } else {
                _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
            };
            _object setVariable["memDir",_dir,true];
            if ((typeOf _object) in dayz_allowedObjects) then {
//#########################REMOVED FOR INDESTRUCTIBLE ITEMS#########################
//                if (DZE_GodModeBase) then {
//                    _object addEventHandler ["HandleDamage", {false}];
//                } else {
//                    _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
//                };
//##################################################################################
                // Test disabling simulation server side on buildables only.
                _object enableSimulation false;
                // used for inplace upgrades && lock/unlock of safe
                _object setVariable ["OEMPos", _pos, true];
                
            };

            if ((count _inventory > 0) && !(typeOf( _object) == "Plastic_Pole_EP1_DZ") && !(typeOf( _object) in  DZE_DoorsLocked)) then {
                if (_type in DZE_LockedStorage) then {
                    // Fill variables with loot
                    _object setVariable ["WeaponCargo", (_inventory select 0),true];
                    _object setVariable ["MagazineCargo", (_inventory select 1),true];
                    _object setVariable ["BackpackCargo", (_inventory select 2),true];
                } else {

                    //Add weapons
                    _objWpnTypes = (_inventory select 0) select 0;
                    _objWpnQty = (_inventory select 0) select 1;
                    _countr = 0;                    
                    {
                        if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
                            _x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
                        };
                        _isOK =     isClass(configFile >> "CfgWeapons" >> _x);
                        if (_isOK) then {
                            _object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;
                
                    //Add Magazines
                    _objWpnTypes = (_inventory select 1) select 0;
                    _objWpnQty = (_inventory select 1) select 1;
                    _countr = 0;
                    {
                        if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
                        if (_x == "ItemTent") then { _x = "ItemTentOld" };
                        _isOK =     isClass(configFile >> "CfgMagazines" >> _x);
                        if (_isOK) then {
                            _object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;

                    //Add Backpacks
                    _objWpnTypes = (_inventory select 2) select 0;
                    _objWpnQty = (_inventory select 2) select 1;
                    _countr = 0;
                    {
                        _isOK =     isClass(configFile >> "CfgVehicles" >> _x);
                        if (_isOK) then {
                            _object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
                        };
                        _countr = _countr + 1;
                    } count _objWpnTypes;
                };
            };    
            
            if (_object isKindOf "AllVehicles") then {
                _object setVariable ["lastInventory", _inventory];
                _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
                {
                    _selection = _x select 0;
                    _dam = _x select 1;
                    if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
                    [_object,_selection,_dam] call object_setFixServer;
                } count _hitpoints;

                _object setFuel _fuel;

                if (!((typeOf _object) in dayz_allowedObjects)) then {
                    
                    //_object setvelocity [0,0,1];
                    _object call fnc_veh_ResetEH;        
                    
                    if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
                        _object setvehiclelock "locked";
                    };
                    
                    _totalvehicles = _totalvehicles + 1;

                    // total each vehicle
                    serverVehicleCounter set [count serverVehicleCounter,_type];
                };
            };

            //Monitor the object
            PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
        };
        if( _currentCount == _newMileStone)then{ // to reduce bandwith
        _newMileStone = _newMileStone + 50; // every 50 items loaded refresh message
        _theMessage = format ["Spawned %1 of %2 objects",_currentCount, _ammountOfObject];
        PVDZE_Z_LoadMessage = [_theMessage];
        publicVariable "PVDZE_Z_LoadMessage";
        };
        _currentCount = _currentCount + 1;
    } forEach (_BuildingQueue + _objectQueue);
    // # END SPAWN OBJECTS #

    // preload server traders menu data into cache
    if !(DZE_ConfigTrader) then {
    _theMessage = "Traders Opening thier Shops";
    PVDZE_Z_LoadMessage = [_theMessage];
    publicVariable "PVDZE_Z_LoadMessage";
        {
            // get tids
            _traderData = call compile format["menu_%1;",_x];
            if(!isNil "_traderData") then {
                {
                    _traderid = _x select 1;

                    _retrader = [];

                    _key = format["CHILD:399:%1:",_traderid];
                    _data = "HiveEXT" callExtension _key;

                    //diag_log "HIVE: Request sent";
            
                    //Process result
                    _result = call compile format ["%1",_data];
                    _status = _result select 0;
            
                    if (_status == "ObjectStreamStart") then {
                        _val = _result select 1;
                        //Stream Objects
                        //diag_log ("HIVE: Commence Menu Streaming...");
                        call compile format["ServerTcache_%1 = [];",_traderid];
                        for "_i" from 1 to _val do {
                            _data = "HiveEXT" callExtension _key;
                            _result = call compile format ["%1",_data];
                            call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];
                            _retrader set [count _retrader,_result];
                        };
                        //diag_log ("HIVE: Streamed " + str(_val) + " objects");
                    };

                } forEach (_traderData select 0);
            };
        } forEach serverTraders;
    };

    if (_hiveLoaded) then {

        //  spawn_vehicles
        _vehLimit = MaxVehicleLimit - _totalvehicles;
        _theMessage = format["Spawning %1 new vehicles", _vehLimit];
        PVDZE_Z_LoadMessage = [_theMessage];
        publicVariable "PVDZE_Z_LoadMessage";
        if(_vehLimit > 0) then {
            diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
            for "_x" from 1 to _vehLimit do {
                [] spawn spawn_vehicles;
            };
        } else {
            diag_log "HIVE: Vehicle Spawn limit reached!";
        };
    };
    _theMessage = "Agro-ing Zeds around you";
    PVDZE_Z_LoadMessage = [_theMessage];
    publicVariable "PVDZE_Z_LoadMessage";
    //  spawn_roadblocks
    diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
    for "_x" from 1 to MaxDynamicDebris do {
        [] spawn spawn_roadblocks;
    };
    //  spawn_ammosupply at server start 1% of roadblocks
    diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
    for "_x" from 1 to MaxAmmoBoxes do {
        [] spawn spawn_ammosupply;
    };
    // call spawning mining veins
    diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
    for "_x" from 1 to MaxMineVeins do {
        [] spawn spawn_mineveins;
    };

    if(isnil "dayz_MapArea") then {
        dayz_MapArea = 10000;
    };
    if(isnil "HeliCrashArea") then {
        HeliCrashArea = dayz_MapArea / 2;
    };
    if(isnil "OldHeliCrash") then {
        OldHeliCrash = false;
    };

    // [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
    if(OldHeliCrash) then {
        _nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
    };
    if (isDedicated) then {
        // Epoch Events
        _id = [] spawn server_spawnEvents;
        // server cleanup
        [] spawn {
            private ["_id"];
            sleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
            waitUntil {!isNil "server_spawnCleanAnimals"};
            _id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
        };

        // spawn debug box
        _debugMarkerPosition = getMarkerPos "respawn_west";
        _debugMarkerPosition = [(_debugMarkerPosition select 0),(_debugMarkerPosition select 1),1];
        _vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"];
        _vehicle_0 setPos _debugMarkerPosition;
        _vehicle_0 setVariable ["ObjectID","1",true];

        // max number of spawn markers
        if(isnil "spawnMarkerCount") then {
            spawnMarkerCount = 10;
        };
        actualSpawnMarkerCount = 0;
        // count valid spawn marker positions
        for "_i" from 0 to spawnMarkerCount do {
            if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then {
                actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
            } else {
                // exit since we did not find any further markers
                _i = spawnMarkerCount + 99;
            };
            
        };
        diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];
        _theMessage = format["Waking up your Character", _vehLimit];
        PVDZE_Z_LoadMessage = [_theMessage];
        publicVariable "PVDZE_Z_LoadMessage";
        endLoadingScreen;
    };
    [] ExecVM "\z\addons\dayz_server\WAI\init.sqf";
    [] ExecVM "\z\addons\dayz_server\DZMS\DZMSInit.sqf";
    allowConnection = true;    
    sm_done = true;
    publicVariable "sm_done";
};

Link to comment
Share on other sites

player_build_publish.sqf

private ["_passArray","_cancel","_position","_reason","_classnametmp","_classname","_tmpbuilt","_dir","_location","_text","_limit","_isOk","_proceed","_counter","_dis","_sfx","_started","_finished","_animState","_isMedic","_num_removed","_lockable","_combinationDisplay","_combination_1","_combination_2","_combination_3","_combination_4","_combination","_combination_1_Display","_playerUID","_OwnerUID","_vector","_buildOffset","_vUp"];

//defines
_cancel = _this select 0;
_position = _this select 1;
_classnametmp = _this select 2;
_isAllowedUnderGround = _this select 3;
_text = _this select 4;
_isPole = _this select 5;
_lockable = _this select 6;
_dir = _this select 7;
_reason = _this select 8;
_vector = _this select 9;

_playerUID = [player] call FNC_GetPlayerUID;

if (DZE_APlotforLife) then {
    _OwnerUID = _playerUID;
}else{
    _OwnerUID = dayz_characterID;
};

_passArray = [];

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

    cutText [format[(localize "str_epoch_player_138"),_text], "PLAIN DOWN"];

    _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");
        };
    };

    while {_isOk} do { //publish phase

        [10,10] call dayz_HungerThirst;
        player playActionNow "Medic"; //animation
        
        //alert zombies
        _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 { //while player is not interrupted, go trough animations
            _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 { //exit if interrupted
            _isOk = false;
            _proceed = false;
        };

        if(_finished) then { //if animation finished, add to build count
            _counter = _counter + 1;
        };

        cutText [format[(localize "str_epoch_player_139"),_text, _counter,_limit], "PLAIN DOWN"]; //report how many steps are done out of total limit

        if(_counter == _limit) exitWith { //if all steps done proceed with next step, otherwise cancel publish
            _isOk = false;
            _proceed = true;
        };

    };

    if (_proceed) then {

        _num_removed = ([player,DZE_buildItem] call BIS_fnc_invRemove); //remove item's magazine from inventory
        if(_num_removed == 1) then {

            cutText [format[localize "str_build_01",_text], "PLAIN DOWN"];

            if (_isPole) then { //if item was a plotpole, build a visual radius around it
                [] spawn player_plotPreview;
            };

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

            if(_lockable > 1) then { //if item has code lock on it

                _combinationDisplay = ""; //define new display

                switch (_lockable) do { //generate random combinations depending on item type

                    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",_OwnerUID,true];
                
                //call publish precompiled function with given args and send public variable to server to save item to database
                PVDZE_obj_Publish = [_combination,_tmpbuilt,[_dir,_location,_playerUID,_vector],_classname];
                publicVariableServer "PVDZE_obj_Publish";

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


            } else { //if not lockable item
                _tmpbuilt setVariable ["CharacterID",dayz_characterID,true];
                _tmpbuilt setVariable ["ownerPUID",_OwnerUID,true];

                // fire?
                if(_tmpbuilt isKindOf "Land_Fire_DZ") then { //if campfire, then spawn, but do not publish to database
                    _tmpbuilt spawn player_fireMonitor;
                } else {
                    
                    PVDZE_obj_Publish = [dayz_characterID,_tmpbuilt,[_dir,_location,_playerUID,_vector],_classname];
                    publicVariableServer "PVDZE_obj_Publish";
                };
            };
        } else { //if magazine was not removed, cancel publish
            deleteVehicle _tmpbuilt;
            cutText [(localize "str_epoch_player_46") , "PLAIN DOWN"];
        };

    } else { //if player was interrupted, cancel publish and stop build animations
        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 { //cancel build if passed _cancel arg was true or building on roads/trader city
    cutText [format[(localize "str_epoch_player_47"),_text,_reason], "PLAIN DOWN"];
};

DZE_ActionInProgress = false; //in any case always finish last function with this to "reset" everything.

player_upgrade.sqf

/*
    DayZ Base Building Upgrades
    Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
*/
private ["_location","_dir","_classname","_missing","_text","_proceed","_num_removed","_object","_missingQty","_itemIn","_countIn","_qty","_removed","_removed_total","_tobe_removed_total","_objectID","_objectUID","_temp_removed_array","_textMissing","_newclassname","_requirements","_obj","_upgrade","_lockable","_combination_1","_combination_2","_combination_3","_combination","_objectCharacterID","_canBuildOnPlot","_friendlies","_nearestPole","_ownerID","_distance","_needText","_findNearestPoles","_findNearestPole","_IsNearPlot","_playerUID","_vector"];

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

player removeAction s_player_upgrade_build;
s_player_upgrade_build = 1;


_distance = 30;
_needText = localize "str_epoch_player_246";

// check for near plot
_findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];
_findNearestPole = [];

{
    if (alive _x) then {
        _findNearestPole set [(count _findNearestPole),_x];
    };
} count _findNearestPoles;

_IsNearPlot = count (_findNearestPole);

_canBuildOnPlot = false;

if(_IsNearPlot == 0) then {
    _canBuildOnPlot = true;
} else {
    
    // check nearby plots ownership && then for friend status
    _nearestPole = _findNearestPole select 0;

    // Find owner
    _ownerID = _nearestPole getVariable["ownerPUID","0"];
    
    if (DZE_APlotforLife) then {
        _playerUID = [player] call FNC_GetPlayerUID;
    }else{
        _playerUID = dayz_characterID;
    };

    // diag_log format["DEBUG BUILDING: %1 = %2", dayz_characterID, _ownerID];

    // check if friendly to owner
    if(_playerUID == _ownerID) then {
        _canBuildOnPlot = true;        
    } else {
        _friendlies = _nearestPole getVariable ["plotfriends",[]];
        _fuid  = [];
        {
              _friendUID = _x select 0;
              _fuid  =  _fuid  + [_friendUID];
        } forEach _friendlies;
        _builder  = getPlayerUID player;
        // check if friendly to owner
        if(_builder in _fuid) then {
            _canBuildOnPlot = true;
        };
    };
};

// exit if not allowed due to plot pole
if(!_canBuildOnPlot) exitWith {  DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_157"),_needText,_distance] , "PLAIN DOWN"]; };

// get cursortarget from addaction
_obj = _this select 3;

// Find objectID
_objectID     = _obj getVariable ["ObjectID","0"];

// Find objectUID
_objectUID    = _obj getVariable ["ObjectUID","0"];

if(_objectID == "0" && _objectUID == "0") exitWith {DZE_ActionInProgress = false; s_player_upgrade_build = -1; cutText [(localize "str_epoch_player_50"), "PLAIN DOWN"];};

// Get classname
_classname = typeOf _obj;

// Find display name
_text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");

// Find next upgrade
_upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "upgradeBuilding");

if ((count _upgrade) > 0) then {

    _newclassname = _upgrade select 0;

    _lockable = 0;
    if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {
        _lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");
    };

    _requirements = _upgrade select 1;
    
    _missingQty = 0;
    _missing = "";
    
    _proceed = true;
    {
        _itemIn = _x select 0;
        _countIn = _x select 1;
        _qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;
        if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };
    } forEach _requirements;
    
    if (_proceed) then {
        [1,1] call dayz_HungerThirst;
        player playActionNow "Medic";
        [player,20,true,(getPosATL player)] spawn player_alertZombies;
    
        _temp_removed_array = [];
        _removed_total = 0;
        _tobe_removed_total = 0;
        
        {
            _removed = 0;
            _itemIn = _x select 0;
            _countIn = _x select 1;
            // diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
            _tobe_removed_total = _tobe_removed_total + _countIn;

            {                    
                if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {
                    _num_removed = ([player,_x] call BIS_fnc_invRemove);
                    _removed = _removed + _num_removed;
                    _removed_total = _removed_total + _num_removed;
                    if(_num_removed >= 1) then {
                        _temp_removed_array set [count _temp_removed_array,_x];
                    };
                };
        
            } forEach magazines player;

        } forEach _requirements;

        // all parts removed proceed
        if (_tobe_removed_total == _removed_total) then {
            
            // Get position
            _location    = _obj getVariable["OEMPos",(getposATL _obj)];

            // Get direction
            _dir = getDir _obj;
            
            // Get vector
            _vector = [(vectorDir _obj),(vectorUp _obj)];    

            // Current charID
            _objectCharacterID     = _obj getVariable ["CharacterID","0"];
            _ownerID = _obj getVariable["ownerPUID","0"];

            _classname = _newclassname;
            
            // Create new object
            _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];

            // Set direction
            _object setDir _dir;
            _object setVariable["memDir",_dir,true];
            
            // Set vector
            _object setVectorDirAndUp _vector;

            // Set location
            _object setPosATL _location;

            // Set Owner.
            _object setVariable ["ownerPUID",_ownerID,true];

            if (_lockable == 3) then {

                _combination_1 = floor(random 10);
                _combination_2 = floor(random 10);
                _combination_3 = floor(random 10);
                _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];
                
                _objectCharacterID = _combination;
                
                cutText [format[(localize "str_epoch_player_158"),_combination,_text], "PLAIN DOWN", 5];
            } else {    
                cutText [format[(localize "str_epoch_player_159"),_text], "PLAIN DOWN", 5];
            };

            _playerUID = [player] call FNC_GetPlayerUID;
            PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location, _playerUID,_vector],_classname,_obj,player];
            publicVariableServer "PVDZE_obj_Swap";

            player reveal _object;
            
        } else {
        
            {player addMagazine _x;} count _temp_removed_array;
            cutText [format[(localize "str_epoch_player_145"),_removed_total,_tobe_removed_total], "PLAIN DOWN"];
        
        };
    } else {
        _textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
        cutText [format[(localize "str_epoch_player_146"),_missingQty, _textMissing], "PLAIN DOWN"];
    };

} else {
    cutText [(localize "str_epoch_player_82"), "PLAIN DOWN"];
};

DZE_ActionInProgress = false;
s_player_upgrade_build = -1;

Link to comment
Share on other sites

Hi Striker, 

 

First off here is HIVE entry for metal floor placement before adding vectorbuild.

 

18:39:14 "CHILD:308:24:MetalFloor_DZ:0:374:[268.449,[6636,6735.56,0.317451]]:[]:[]:0:66360673563268:"

here is HIVE entry after putting vectorbuild in.

15:31:27 "CHILD:308:24:MetalFloor_DZ:0:374:[268.481,[6635.65,6746.12,-0.222519],[[-0.984462,-0.0261058,0.173648],[0.173587,0.00460316,0.984808]]]:[]:[]:0:663576746122252:"

After talking with you in TS earlier and getting Vector build in place.  I have follow error when attempting to place a Metal Floor with vector build.

 

15:31:27 Error in expression <Cnt = 0;
{
_set = _x;
{ 
_vecCnt = _vecCnt + (round (_x * 100));
} count >
15:31:27   Error position: <= _vecCnt + (round (_x * 100));
} count >
15:31:27   Error Type Number, expected Bool
15:31:27 File z\addons\dayz_server\init\server_functions.sqf, line 624
15:31:27 "CHILD:308:24:MetalFloor_DZ:0:374:[268.481,[6635.65,6746.12,-0.222519],[[-0.984462,-0.0261058,0.173648],[0.173587,0.00460316,0.984808]]]:[]:[]:0:663576746122252:"

The last line in the MetalFloor that was placed.

 

server_functions.sqf

waituntil {!isnil "bis_fnc_init"};
BIS_MPF_remoteExecutionServer = {
if ((_this select 1) select 2 == "JIPrequest") then {
[nil,(_this select 1) select 0,"loc",rJIPEXEC,[any,any,"per","execVM","ca\Modules\Functions\init.sqf"]] call RE;
};
};

MyPlayerCounter = 1;

BIS_Effects_Burn = {};
server_playerLogin = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerLogin.sqf";
server_playerSetup = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSetup.sqf";
server_onPlayerDisconnect = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_onPlayerDisconnect.sqf";
server_updateObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_updateObject.sqf";
server_playerDied = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDied.sqf";
server_publishObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishObject.sqf";
server_deleteObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_deleteObj.sqf";
server_swapObject = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_swapObject.sqf";
server_publishVeh = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle.sqf";
server_publishVeh2 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle2.sqf";
server_publishVeh3 = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_publishVehicle3.sqf";
server_tradeObj = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_tradeObject.sqf";
server_traders = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_traders.sqf";
server_playerSync = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerSync.sqf";
server_spawnCrashSite = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnCrashSite.sqf";
server_spawnEvents = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnEvent.sqf";
//server_weather = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_weather.sqf";
fnc_plyrHit = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fnc_plyrHit.sqf";
server_deaths = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDeaths.sqf";
server_maintainArea = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_maintainArea.sqf";

/* PVS/PVC - Skaronator */
server_sendToClient = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_sendToClient.sqf";

//onPlayerConnected {[_uid,_name] call server_onPlayerConnect;};
onPlayerDisconnected {[_uid,_name] call server_onPlayerDisconnect;};

server_updateNearbyObjects = {
private["_pos"];
_pos = _this select 0;
{
[_x, "gear"] call server_updateObject;
} count nearestObjects [_pos, dayz_updateObjects, 10];
};

server_handleZedSpawn = {
private["_zed"];
_zed = _this select 0;
_zed enableSimulation false;
};

zombie_findOwner = {
private["_unit"];
_unit = _this select 0;
#ifdef DZE_SERVER_DEBUG
diag_log ("CLEANUP: DELETE UNCONTROLLED ZOMBIE: " + (typeOf _unit) + " OF: " + str(_unit) );
#endif
deleteVehicle _unit;
};

vehicle_handleInteract = {
private["_object"];
_object = _this select 0;
needUpdate_objects = needUpdate_objects - [_object];
[_object, "all"] call server_updateObject;
};

array_reduceSizeReverse = {
private["_array","_count","_num","_newarray","_startnum","_index"];
_array = _this select 0;
_newarray = [];
_count = _this select 1;
_num = count _array;
if (_num > _count) then {
_startnum = _num - 1;
_index = _count - 1;
for "_i" from 0 to _index do {
_newarray set [(_index-_i),_array select (_startnum - _i)];
};
_array = _newarray;
};
_array
};

array_reduceSize = {
private ["_array1","_array","_count","_num"];
_array1 = _this select 0;
_array = _array1 - ["Hatchet_Swing","Machete_Swing","Fishing_Swing","sledge_swing","crowbar_swing","CSGAS"];
_count = _this select 1;
_num = count _array;
if (_num > _count) then {
_array resize _count;
};
_array
};

object_handleServerKilled = {
private["_unit","_objectID","_objectUID","_killer"];
_unit = _this select 0;
_killer = _this select 1;

_objectID = _unit getVariable ["ObjectID","0"];
_objectUID = _unit getVariable ["ObjectUID","0"];

[_objectID,_objectUID,_killer] call server_deleteObj;

_unit removeAllMPEventHandlers "MPKilled";
_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "HandleDamage";
_unit removeAllEventHandlers "GetIn";
_unit removeAllEventHandlers "GetOut";
};

check_publishobject = {
private["_allowed","_object","_playername"];

_object = _this select 0;
_playername = _this select 1;
_allowed = false;

if ((typeOf _object) in dayz_allowedObjects) then {
//diag_log format ["DEBUG: Object: %1 published by %2 is Safe",_object, _playername];
_allowed = true;
};
_allowed
};

//event Handlers
eh_localCleanup = {
private ["_object"];
_object = _this select 0;
_object addEventHandler ["local", {
if(_this select 1) then {
private["_type","_unit"];
_unit = _this select 0;
_type = typeOf _unit;
_myGroupUnit = group _unit;
_unit removeAllMPEventHandlers "mpkilled";
_unit removeAllMPEventHandlers "mphit";
_unit removeAllMPEventHandlers "mprespawn";
_unit removeAllEventHandlers "FiredNear";
_unit removeAllEventHandlers "HandleDamage";
_unit removeAllEventHandlers "Killed";
_unit removeAllEventHandlers "Fired";
_unit removeAllEventHandlers "GetOut";
_unit removeAllEventHandlers "GetIn";
_unit removeAllEventHandlers "Local";
clearVehicleInit _unit;
deleteVehicle _unit;
if ((count (units _myGroupUnit) == 0) && (_myGroupUnit != grpNull)) then {
deleteGroup _myGroupUnit;
};
//_unit = nil;
// diag_log ("CLEANUP: DELETED A " + str(_type) );
};
}];
};

server_hiveWrite = {
private["_data"];
diag_log ("ATTEMPT WRITE: " + _this);
//_data = "HiveExt" callExtension _this;
};

server_hiveReadWrite = {
private["_key","_resultArray","_data"];
_key = _this;
diag_log ("ATTEMPT READ/WRITE: " + _key);
//_data = "HiveExt" callExtension _key;
_resultArray = nil; //call compile format ["%1",_data];
_resultArray
};

server_hiveReadWriteLarge = {
private["_key","_resultArray","_data"];
_key = _this;
diag_log ("ATTEMPT READ/WRITE LARGE: " + _key);
//_data = "HiveExt" callExtension _key;
_resultArray = nil; //call compile _data;
_resultArray
};

server_checkIfTowed = {
private ["_vehicle","_player","_attached"];
if (DZE_HeliLift) then {
_vehicle = _this select 0;
_player = _this select 2;
_attached = _vehicle getVariable["attached",false];
if (typeName _attached == "OBJECT") then {
_player action ["eject", _vehicle];
detach _vehicle;
_vehicle setVariable["attached",false,true];
_attached setVariable["hasAttached",false,true];
};
};
};

server_characterSync = {
private ["_characterID","_playerPos","_playerGear","_playerBackp","_medical","_currentState","_currentModel","_key"];
_characterID = _this select 0;
_playerPos = _this select 1;
_playerGear = _this select 2;
_playerBackp = _this select 3;
_medical = _this select 4;
_currentState = _this select 5;
_currentModel = _this select 6;

diag_log format["CHILD:201:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:",_characterID,_playerPos,_playerGear,_playerBackp,_medical,false,false,0,0,0,0,_currentState,0,0,_currentModel,0];
};

if(isnil "dayz_MapArea") then {
dayz_MapArea = 10000;
};
if(isnil "DynamicVehicleArea") then {
DynamicVehicleArea = dayz_MapArea / 2;
};

// Get all buildings && roads only once TODO: set variables to nil after done if nessicary
MarkerPosition = getMarkerPos "center";
RoadList = MarkerPosition nearRoads DynamicVehicleArea;

// Very taxing !!! but only on first startup
BuildingList = [];
{
if (DZE_MissionLootTable) then {
if (isClass (missionConfigFile >> "CfgBuildingLoot" >> (typeOf _x))) then
{
BuildingList set [count BuildingList,_x];
};
} else {
if (isClass (configFile >> "CfgBuildingLoot" >> (typeOf _x))) then
{
BuildingList set [count BuildingList,_x];
};
};


} count (MarkerPosition nearObjects ["building",DynamicVehicleArea]);

spawn_vehicles = {
private ["_random","_lastIndex","_weights","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition","_marker","_iClass","_itemTypes","_cntWeights","_itemType","_num","_allCfgLoots"];

if (!isDedicated) exitWith { }; //Be sure the run this

while {count AllowedVehiclesList > 0} do {
// BIS_fnc_selectRandom replaced because the index may be needed to remove the element
_index = floor random count AllowedVehiclesList;
_random = AllowedVehiclesList select _index;

_vehicle = _random select 0;
_velimit = _random select 1;

_qty = {_x == _vehicle} count serverVehicleCounter;

// If under limit allow to proceed
if (_qty <= _velimit) exitWith {};

// vehicle limit reached, remove vehicle from list
// since elements cannot be removed from an array, overwrite it with the last element && cut the last element of (as long as order is not important)
_lastIndex = (count AllowedVehiclesList) - 1;
if (_lastIndex != _index) then {
AllowedVehiclesList set [_index, AllowedVehiclesList select _lastIndex];
};
AllowedVehiclesList resize _lastIndex;
};

if (count AllowedVehiclesList == 0) then {
diag_log("DEBUG: unable to find suitable vehicle to spawn");
} else {

// add vehicle to counter for next pass
serverVehicleCounter set [count serverVehicleCounter,_vehicle];

// Find Vehicle Type to better control spawns
_isAir = _vehicle isKindOf "Air";
_isShip = _vehicle isKindOf "Ship";

if(_isShip || _isAir) then {
if(_isShip) then {
// Spawn anywhere on coast on water
waitUntil{!isNil "BIS_fnc_findSafePos"};
_position = [MarkerPosition,0,DynamicVehicleArea,10,1,2000,1] call BIS_fnc_findSafePos;
//diag_log("DEBUG: spawning boat near coast " + str(_position));
} else {
// Spawn air anywhere that is flat
waitUntil{!isNil "BIS_fnc_findSafePos"};
_position = [MarkerPosition,0,DynamicVehicleArea,10,0,2000,0] call BIS_fnc_findSafePos;
//diag_log("DEBUG: spawning air anywhere flat " + str(_position));
};


} else {
// Spawn around buildings && 50% near roads
if((random 1) > 0.5) then {

waitUntil{!isNil "BIS_fnc_selectRandom"};
_position = RoadList call BIS_fnc_selectRandom;

_position = _position modelToWorld [0,0,0];

waitUntil{!isNil "BIS_fnc_findSafePos"};
_position = [_position,0,10,10,0,2000,0] call BIS_fnc_findSafePos;

//diag_log("DEBUG: spawning near road " + str(_position));

} else {

waitUntil{!isNil "BIS_fnc_selectRandom"};
_position = BuildingList call BIS_fnc_selectRandom;

_position = _position modelToWorld [0,0,0];

waitUntil{!isNil "BIS_fnc_findSafePos"};
_position = [_position,0,40,5,0,2000,0] call BIS_fnc_findSafePos;

//diag_log("DEBUG: spawning around buildings " + str(_position));

};
};
// only proceed if two params otherwise BIS_fnc_findSafePos failed && may spawn in air
if ((count _position) == 2) then {

_dir = round(random 180);

_istoomany = _position nearObjects ["AllVehicles",50];
if((count _istoomany) > 0) exitWith { diag_log("DEBUG: Too many vehicles at " + str(_position)); };

//place vehicle
_veh = createVehicle [_vehicle, _position, [], 0, "CAN_COLLIDE"];
_veh setdir _dir;
_veh setpos _position;

if(DZEdebug) then {
_marker = createMarker [str(_position) , _position];
_marker setMarkerShape "ICON";
_marker setMarkerType "DOT";
_marker setMarkerText _vehicle;
};

// Get position with ground
_objPosition = getPosATL _veh;

clearWeaponCargoGlobal _veh;
clearMagazineCargoGlobal _veh;
// _veh setVehicleAmmo DZE_vehicleAmmo;

// Add 0-3 loots to vehicle using random cfgloots
_num = floor(random 4);
_allCfgLoots = ["trash","civilian","food","generic","medical","military","policeman","hunter","worker","clothes","militaryclothes","specialclothes","trash"];

for "_x" from 1 to _num do {
_iClass = _allCfgLoots call BIS_fnc_selectRandom;

_itemTypes = [];
if (DZE_MissionLootTable) then{
{
_itemTypes set[count _itemTypes, _x select 0]
} count getArray(missionConfigFile >> "cfgLoot" >> _iClass);
}
else {
{
_itemTypes set[count _itemTypes, _x select 0]
} count getArray(configFile >> "cfgLoot" >> _iClass);
};

_index = dayz_CLBase find _iClass;
_weights = dayz_CLChances select _index;
_cntWeights = count _weights;

_index = floor(random _cntWeights);
_index = _weights select _index;
_itemType = _itemTypes select _index;
_veh addMagazineCargoGlobal [_itemType,1];
//diag_log("DEBUG: spawed loot inside vehicle " + str(_itemType));
};

[_veh,[_dir,_objPosition],_vehicle,true,"0"] call server_publishVeh;
};
};
};

spawn_ammosupply = {
private ["_position","_veh","_istoomany","_marker","_spawnveh","_WreckList"];
if (isDedicated) then {
_WreckList = ["Supply_Crate_DZE"];
waitUntil{!isNil "BIS_fnc_selectRandom"};
_position = RoadList call BIS_fnc_selectRandom;
_position = _position modelToWorld [0,0,0];
waitUntil{!isNil "BIS_fnc_findSafePos"};
_position = [_position,5,20,5,0,2000,0] call BIS_fnc_findSafePos;
if ((count _position) == 2) then {

_istoomany = _position nearObjects ["All",5];

if((count _istoomany) > 0) exitWith { diag_log("DEBUG VEIN: Too many at " + str(_position)); };

_spawnveh = _WreckList call BIS_fnc_selectRandom;

if(DZEdebug) then {
_marker = createMarker [str(_position) , _position];
_marker setMarkerShape "ICON";
_marker setMarkerType "DOT";
_marker setMarkerText str(_spawnveh);
};

_veh = createVehicle [_spawnveh,_position, [], 0, "CAN_COLLIDE"];
_veh enableSimulation false;
_veh setDir round(random 360);
_veh setpos _position;
_veh setVariable ["ObjectID","1",true];
};
};
};

DZE_LocalRoadBlocks = [];

spawn_roadblocks = {
private ["_position","_veh","_istoomany","_marker","_spawnveh","_WreckList"];
_WreckList = ["SKODAWreck","HMMWVWreck","UralWreck","datsun01Wreck","hiluxWreck","datsun02Wreck","UAZWreck","Land_Misc_Garb_Heap_EP1","Fort_Barricade_EP1","Rubbish2"];

waitUntil{!isNil "BIS_fnc_selectRandom"};
if (isDedicated) then {

_position = RoadList call BIS_fnc_selectRandom;

_position = _position modelToWorld [0,0,0];

waitUntil{!isNil "BIS_fnc_findSafePos"};
_position = [_position,0,10,5,0,2000,0] call BIS_fnc_findSafePos;

if ((count _position) == 2) then {
// Get position with ground

_istoomany = _position nearObjects ["All",5];

if((count _istoomany) > 0) exitWith { diag_log("DEBUG: Too many at " + str(_position)); };

waitUntil{!isNil "BIS_fnc_selectRandom"};
_spawnveh = _WreckList call BIS_fnc_selectRandom;

if(DZEdebug) then {
_marker = createMarker [str(_position) , _position];
_marker setMarkerShape "ICON";
_marker setMarkerType "DOT";
_marker setMarkerText str(_spawnveh);
};

_veh = createVehicle [_spawnveh,_position, [], 0, "CAN_COLLIDE"];
_veh enableSimulation false;

_veh setDir round(random 360); // Randomize placement a bit
_veh setpos _position;

_veh setVariable ["ObjectID","1",true];
};

};

};

spawn_mineveins = {
private ["_position","_veh","_istoomany","_marker","_spawnveh","_positions"];

if (isDedicated) then {

_position = [getMarkerPos "center",0,(HeliCrashArea*0.75),10,0,2000,0] call BIS_fnc_findSafePos;

if ((count _position) == 2) then {

_positions = selectBestPlaces [_position, 500, "(1 + forest) * (1 + hills) * (1 - houses) * (1 - sea)", 10, 5];

_position = (_positions call BIS_fnc_selectRandom) select 0;

// Get position with ground
_istoomany = _position nearObjects ["All",10];

if((count _istoomany) > 0) exitWith { diag_log("DEBUG VEIN: Too many objects at " + str(_position)); };

if(isOnRoad _position) exitWith { diag_log("DEBUG VEIN: on road " + str(_position)); };

_spawnveh = ["Iron_Vein_DZE","Iron_Vein_DZE","Iron_Vein_DZE","Iron_Vein_DZE","Iron_Vein_DZE","Silver_Vein_DZE","Silver_Vein_DZE","Silver_Vein_DZE","Gold_Vein_DZE","Gold_Vein_DZE"] call BIS_fnc_selectRandom;

if(DZEdebug) then {
_marker = createMarker [str(_position) , _position];
_marker setMarkerShape "ICON";
_marker setMarkerType "DOT";
_marker setMarkerText str(_spawnveh);
};

//diag_log("DEBUG: Spawning a crashed " + _spawnveh + " with " + _spawnloot + " at " + str(_position));
_veh = createVehicle [_spawnveh,_position, [], 0, "CAN_COLLIDE"];
_veh enableSimulation false;

// Randomize placement a bit
_veh setDir round(random 360);
_veh setpos _position;

_veh setVariable ["ObjectID","1",true];


};
};
};

if(isnil "DynamicVehicleDamageLow") then {
DynamicVehicleDamageLow = 0;
};
if(isnil "DynamicVehicleDamageHigh") then {
DynamicVehicleDamageHigh = 100;
};

if(isnil "DynamicVehicleFuelLow") then {
DynamicVehicleFuelLow = 0;
};
if(isnil "DynamicVehicleFuelHigh") then {
DynamicVehicleFuelHigh = 100;
};

if(isnil "DZE_DiagFpsSlow") then {
DZE_DiagFpsSlow = false;
};
if(isnil "DZE_DiagFpsFast") then {
DZE_DiagFpsFast = false;
};
if(isnil "DZE_DiagVerbose") then {
DZE_DiagVerbose = false;
};

dze_diag_fps = {
if(DZE_DiagVerbose) then {
diag_log format["DEBUG FPS : %1 OBJECTS: %2 : PLAYERS: %3", diag_fps,(count (allMissionObjects "")),(playersNumber west)];
} else {
diag_log format["DEBUG FPS : %1", diag_fps];
};
};

// Damage generator function
generate_new_damage = {
private ["_damage"];
_damage = ((random(DynamicVehicleDamageHigh-DynamicVehicleDamageLow))+DynamicVehicleDamageLow) / 100;
_damage;
};

// Damage generator fuction
generate_exp_damage = {
private ["_damage"];
_damage = ((random(DynamicVehicleDamageHigh-DynamicVehicleDamageLow))+DynamicVehicleDamageLow) / 100;

// limit this to 85% since vehicle would blow up otherwise.
//if(_damage >= 0.85) then {
// _damage = 0.85;
//};
_damage;
};

server_getDiff = {
private["_variable","_object","_vNew","_vOld","_result"];
_variable = _this select 0;
_object = _this select 1;
_vNew = _object getVariable[_variable,0];
_vOld = _object getVariable[(_variable + "_CHK"),_vNew];
_result = 0;
if (_vNew < _vOld) then {
//JIP issues
_vNew = _vNew + _vOld;
_object getVariable[(_variable + "_CHK"),_vNew];
} else {
_result = _vNew - _vOld;
_object setVariable[(_variable + "_CHK"),_vNew];
};
_result
};

server_getDiff2 = {
private["_variable","_object","_vNew","_vOld","_result"];
_variable = _this select 0;
_object = _this select 1;
_vNew = _object getVariable[_variable,0];
_vOld = _object getVariable[(_variable + "_CHK"),_vNew];
_result = _vNew - _vOld;
_object setVariable[(_variable + "_CHK"),_vNew];
_result
};

dayz_objectUID = {
private["_position","_dir","_key","_object"];
_object = _this;
_position = getPosATL _object;
_dir = direction _object;
_key = [_dir,_position] call dayz_objectUID2;
_key
};

dayz_objectUID2 = {
private["_position","_dir","_key","_element","_vector","_set","_vecCnt","_usedVec"];
_dir = _this select 0;
_key = "";
_position = _this select 1;

if((count _this) == 2) then{
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} count _position;
_key = _key + str(round(_dir));
}else{
_vector = [];
_usedVec = false;
{
_element = _x;
if(typeName _element == "ARRAY") then{
_vector = _element;
if((count _vector) == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} count _position;
_vecCnt = 0;
{
_set = _x;
{
_vecCnt = _vecCnt + (round (_x * 100));
} count _set;
} count _vector;
if(_vecCnt < 0)then{
_vecCnt = ((_vecCnt * -1) * 3);
};
_key = _key + str(_vecCnt);
_usedVec = true;
};
};
};
} count _this;

if!(_usedVec) then{
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} count _position;
_key = _key + str(round(_dir));
};


};
_key
};

dayz_objectUID3 = {
private["_position","_dir","_key"];
_dir = _this select 0;
_key = "";
_position = _this select 1;
{
_x = _x * 10;
if ( _x < 0 ) then { _x = _x * -10 };
_key = _key + str(round(_x));
} count _position;
_key = _key + str(round(_dir + time));
_key
};

dayz_recordLogin = {
private["_key"];
diag_log format["CHILD:103:%1:%2:%3:",_this select 0,_this select 1,_this select 2];
};

dayz_perform_purge = {
if(!isNull(_this)) then {
_group = group _this;
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "Local";
clearVehicleInit _this;
deleteVehicle _this;
if ((count (units _group) == 0) && (_group != grpNull)) then {
deleteGroup _group;
};
};
};

dayz_perform_purge_player = {

private ["_countr","_backpack","_backpackType","_backpackWpn","_backpackMag","_objWpnTypes","_objWpnQty","_location","_dir","_holder","_weapons","_magazines"];
diag_log ("Purging player: " + str(_this));

if(!isNull(_this)) then {

_location = getPosATL _this;
_dir = getDir _this;

_holder = createVehicle ["GraveDZE", _location, [], 0, "CAN_COLLIDE"];
_holder setDir _dir;
_holder setPosATL _location;

_holder enableSimulation false;

_weapons = weapons _this;
_magazines = magazines _this;

// find backpack
if(!(isNull unitBackpack _this)) then {
_backpack = unitBackpack _this;
_backpackType = typeOf _backpack;
_backpackWpn = getWeaponCargo _backpack;
_backpackMag = getMagazineCargo _backpack;

_holder addBackpackCargoGlobal [_backpackType,1];

// add items from backpack
_objWpnTypes = _backpackWpn select 0;
_objWpnQty = _backpackWpn select 1;
_countr = 0;
{
_holder addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} count _objWpnTypes;

// add backpack magazine items
_objWpnTypes = _backpackMag select 0;
_objWpnQty = _backpackMag select 1;
_countr = 0;
{
_holder addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
_countr = _countr + 1;
} count _objWpnTypes;
};
};

// add weapons
{
_holder addWeaponCargoGlobal [_x, 1];
} count _weapons;

// add mags
{
_holder addMagazineCargoGlobal [_x, 1];
} count _magazines;
_group = group _this;
_this removeAllMPEventHandlers "mpkilled";
_this removeAllMPEventHandlers "mphit";
_this removeAllMPEventHandlers "mprespawn";
_this removeAllEventHandlers "FiredNear";
_this removeAllEventHandlers "HandleDamage";
_this removeAllEventHandlers "Killed";
_this removeAllEventHandlers "Fired";
_this removeAllEventHandlers "GetOut";
_this removeAllEventHandlers "GetIn";
_this removeAllEventHandlers "Local";
clearVehicleInit _this;
deleteVehicle _this;
if ((count (units _group) == 0) && (_group != grpNull)) then {
deleteGroup _group;
};
// _this = nil;
};


dayz_removePlayerOnDisconnect = {
if(!isNull(_this)) then {
_group = group _this;
_this removeAllMPEventHandlers "mphit";
deleteVehicle _this;
deleteGroup (group _this);
};
};

server_timeSync = {
//Send request
private ["_hour","_minute","_date","_key","_result","_outcome"];
//_key = "CHILD:307:";
//_result = _key call server_hiveReadWrite;
//_outcome = _result select 0;
//if(_outcome == "PASS") then {
_date = date; //_result select 1;

// if(dayz_fullMoonNights) then {
// _hour = _date select 3;
// _minute = _date select 4;
// //Force full moon nights
// _date = [2013,8,3,_hour,_minute];
// };
//
// setDate _date;
PVDZE_plr_SetDate = _date;
publicVariable "PVDZE_plr_SetDate";
diag_log ("TIME SYNC: Local Time set to " + str(_date));
//};
};

// must spawn these
server_spawncleanDead = {
private ["_deathTime","_delQtyZ","_delQtyP","_qty","_allDead"];
_allDead = allDead;
_delQtyZ = 0;
_delQtyP = 0;
{
if (local _x) then {
if (_x isKindOf "zZombie_Base") then
{
_x call dayz_perform_purge;
sleep 0.05;
_delQtyZ = _delQtyZ + 1;
} else {
if (_x isKindOf "CAManBase") then {
_deathTime = _x getVariable ["processedDeath", diag_tickTime];
if (diag_tickTime - _deathTime > 1800) then {
_x call dayz_perform_purge_player;
sleep 0.025;
_delQtyP = _delQtyP + 1;
};
};
};
};
sleep 0.025;
} count _allDead;
if (_delQtyZ > 0 || _delQtyP > 0) then {
_qty = count _allDead;
diag_log (format["CLEANUP: Deleted %1 players && %2 zombies out of %3 dead",_delQtyP,_delQtyZ,_qty]);
};
};

server_cleanupGroups = {
if (DZE_DYN_AntiStuck3rd > 3) then { DZE_DYN_GroupCleanup = nil; DZE_DYN_AntiStuck3rd = 0; };
if(!isNil "DZE_DYN_GroupCleanup") exitWith { DZE_DYN_AntiStuck3rd = DZE_DYN_AntiStuck3rd + 1;};
DZE_DYN_GroupCleanup = true;
{
if ((count (units _x) == 0) && (_x != grpNull)) then {
deleteGroup _x;
};
sleep 0.001;
} count allGroups;
DZE_DYN_GroupCleanup = nil;
};

server_checkHackers = {
if (DZE_DYN_AntiStuck2nd > 3) then { DZE_DYN_HackerCheck = nil; DZE_DYN_AntiStuck2nd = 0; };
if(!isNil "DZE_DYN_HackerCheck") exitWith { DZE_DYN_AntiStuck2nd = DZE_DYN_AntiStuck2nd + 1;};
DZE_DYN_HackerCheck = true;
{
if (!((isNil "_x") || {(isNull _x)})) then {
// Epoch Admin Tools
if(vehicle _x != _x && !(vehicle _x in PVDZE_serverObjectMonitor) && (isPlayer _x) && !((typeOf vehicle _x) in DZE_safeVehicle) && (vehicle _x getVariable ["MalSar",0] !=1)) then {
diag_log ("CLEANUP: KILLING A HACKER " + (name _x) + " " + str(_x) + " IN " + (typeOf vehicle _x));
(vehicle _x) setDamage 1;
_x setDamage 1;
sleep 0.25;
};
};
sleep 0.001;
} count allUnits;
DZE_DYN_HackerCheck = nil;
};

server_spawnCleanFire = {
private ["_delQtyFP","_qty","_delQtyNull","_missionFires"];
_missionFires = allMissionObjects "Land_Fire_DZ";
_delQtyFP = 0;
{
if (local _x) then {
deleteVehicle _x;
sleep 0.025;
_delQtyFP = _delQtyFP + 1;
};
sleep 0.001;
} count _missionFires;
if (_delQtyFP > 0) then {
_qty = count _missionFires;
diag_log (format["CLEANUP: Deleted %1 fireplaces out of %2",_delQtyNull,_qty]);
};
};

server_spawnCleanLoot = {
private ["_created","_delQty","_nearby","_age","_keep","_qty","_missionObjs","_dateNow"];
if (DZE_DYN_AntiStuck > 3) then { DZE_DYN_cleanLoot = nil; DZE_DYN_AntiStuck = 0; };
if(!isNil "DZE_DYN_cleanLoot") exitWith { DZE_DYN_AntiStuck = DZE_DYN_AntiStuck + 1;};
DZE_DYN_cleanLoot = true;

_missionObjs = allMissionObjects "ReammoBox";
_delQty = 0;
_dateNow = (DateToNumber date);
{
if (!isNull _x) then {
_keep = _x getVariable["permaLoot", false];
if (!_keep) then {
_created = _x getVariable["created", -0.1];
if (_created == -0.1) then{
_x setVariable["created", _dateNow, false];
_created = _dateNow;
}
else {
_age = (_dateNow - _created) * 525948;
if (_age > 20) then{
_nearby = { (isPlayer _x) && (alive _x) } count(_x nearEntities[["CAManBase", "AllVehicles"], 130]);
if (_nearby == 0) then{
deleteVehicle _x;
sleep 0.025;
_delQty = _delQty + 1;
};
};
};
};
};
sleep 0.001;
} count _missionObjs;
if (_delQty > 0) then {
_qty = count _missionObjs;
diag_log (format["CLEANUP: Deleted %1 Loot Piles out of %2",_delQty,_qty]);
};
DZE_DYN_cleanLoot = nil;
};

server_spawnCleanAnimals = {
private ["_pos","_delQtyAnimal","_qty","_missonAnimals","_nearby"];
_missonAnimals = entities "CAAnimalBase";
_delQtyAnimal = 0;
{
if (local _x) then {
_x call dayz_perform_purge;
sleep 0.05;
_delQtyAnimal = _delQtyAnimal + 1;
} else {
if (!alive _x) then {
_pos = getPosATL _x;
if (count _pos > 0) then {
_nearby = {(isPlayer _x) && (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
if (_nearby==0) then {
_x call dayz_perform_purge;
sleep 0.05;
_delQtyAnimal = _delQtyAnimal + 1;
};
};
};
};
sleep 0.001;
} count _missonAnimals;
if (_delQtyAnimal > 0) then {
_qty = count _missonAnimals;
diag_log (format["CLEANUP: Deleted %1 Animals out of %2",_delQtyAnimal,_qty]);
};
};

server_logUnlockLockEvent = {
private["_player", "_obj", "_objectID", "_objectUID", "_statusText", "_status"];
_player = _this select 0;
_obj = _this select 1;
_status = _this select 2;
if (!isNull(_obj)) then {
_objectID = _obj getVariable["ObjectID", "0"];
_objectUID = _obj getVariable["ObjectUID", "0"];
_statusText = "UNLOCKED";
if (_status) then {
[_obj, "gear"] call server_updateObject;
_statusText = "LOCKED";
};
diag_log format["SAFE %5: ID:%1 UID:%2 BY %3(%4)", _objectID, _objectUID, (name _player), (getPlayerUID _player), _statusText];
};
};

 

here is the result after a restart and subsequent attempt to load the HIVE.  

15:41:19 "HIVE: Starting"
15:41:19 "HIVE: Local Time set to [2014,6,6,12,37]"
15:41:19 "LOAD OBJECTS"
15:41:19 Error in expression <22519],[[-0.984462,-0.0261058,0.173648],,[],[],0.000,0.000]]>
15:41:19   Error position: <,[],[],0.000,0.000]]>
15:41:19   Error Invalid number in expression
15:41:19 Error in expression <22519],[[-0.984462,-0.0261058,0.173648],,[],[],0.000,0.000]]>
15:41:19   Error position: <,[],[],0.000,0.000]]>
15:41:19   Error Invalid number in expression
15:41:19 "FOUND  OBJECTS"
15:41:19 "LOAD TRADER: \cache\traders\478.sqf"
15:41:19 Error in expression <og format["FOUND %1 OBJECTS", str(count _objectArray)];


_totalvehicles = 0;
{
>
15:41:19   Error position: <_objectArray)];


_totalvehicles = 0;
{
>
15:41:19   Error Undefined variable in expression: _objectarray
15:41:19 File z\addons\dayz_server\system\server_monitor.sqf, line 61
15:41:19 "Count: 67"

server_monitor.sqf

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

dayz_versionNo = getText(configFile >> "CfgMods" >> "DayZ" >> "version");
dayz_hiveVersionNo = getNumber(configFile >> "CfgMods" >> "DayZ" >> "hiveVersion");

_hiveLoaded = false;

waitUntil{initialized}; //means all the functions are now defined

diag_log "HIVE: Starting";

waituntil{isNil "sm_done"}; // prevent server_monitor be called twice (bug during login of the first player)

// Time sync
if (isDedicated) then {
_result = ["PASS",[2012,6,6,10,10]];
_res = preprocessFile "\cache\set_time.sqf";
if ((_res != "") and !(isNil "_res")) then {
_result = call compile _res;
};
_outcome = _result select 0;

if (_outcome == "PASS") then {
_date = _result select 1;
setDate _date;
PVDZE_plr_SetDate = _date;
publicVariable "PVDZE_plr_SetDate";
diag_log ("HIVE: Local Time set to " + str(_date));
};
};

// Custom Configs
if(isnil "MaxVehicleLimit") then {
MaxVehicleLimit = 50;
};

if(isnil "MaxDynamicDebris") then {
MaxDynamicDebris = 100;
};
if(isnil "MaxAmmoBoxes") then {
MaxAmmoBoxes = 3;
};
if(isnil "MaxMineVeins") then {
MaxMineVeins = 50;
};
// Custon Configs End

if (isServer && isNil "sm_done") then {
serverVehicleCounter = [];
diag_log ("LOAD OBJECTS");

_objectArray = [];

_res = preprocessFile "\cache\objects.sqf";
if ((_res == "") or (isNil "_res")) then {
diag_log ("OBJECTS NOT FOUND!");
} else {
_objectArray = call compile _res;
};
_res = nil;
diag_log format["FOUND %1 OBJECTS", str(count _objectArray)];

// # NOW SPAWN OBJECTS #
_totalvehicles = 0;
{
_idKey = _x select 1;
_type = _x select 2;
_ownerID = _x select 3;

_worldspace = _x select 4;
_intentory = _x select 5;
_hitPoints = _x select 6;
_fuel = _x select 7;
_damage = _x select 8;

_dir = 0;
_pos = [0,0,0];
_wsDone = false;
if (count _worldspace >= 2) then
{
_dir = _worldspace select 0;
if (count (_worldspace select 1) == 3) then {
_pos = _worldspace select 1;
_wsDone = true;
}
};

if (!_wsDone) then {
if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
};
_vector = [[0,0,0],[0,0,0]];
_vecExists = false;
_ownerPUID = "0";
if (count _worldspace >= 3) then{
if(count _worldspace == 3) then{
if(typename (_worldspace select 2) == "STRING")then{
_ownerPUID = _worldspace select 2;
}else{
if(typename (_worldspace select 2) == "ARRAY")then{
_vector = _worldspace select 2;
if(count _vector == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
_vecExists = true;
};
};
};
};

}else{
//Was not 3 elements, so check if 4 or more
if(count _worldspace == 4) then{
if(typename (_worldspace select 3) == "STRING")then{
_ownerPUID = _worldspace select 3;
}else{
if(typename (_worldspace select 2) == "STRING")then{
_ownerPUID = _worldspace select 2;
};
};


if(typename (_worldspace select 2) == "ARRAY")then{
_vector = _worldspace select 2;
if(count _vector == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
_vecExists = true;
};
};
}else{
if(typename (_worldspace select 3) == "ARRAY")then{
_vector = _worldspace select 3;
if(count _vector == 2)then{
if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{
_vecExists = true;
};
};
};
};

}else{
//More than 3 or 4 elements found
//Might add a search for the vector, ownerPUID will equal 0
};
};
};

if (_damage < 1) then {
//diag_log format["OBJ: %1 - %2", _idKey,_type];

//Create it
_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
_object setVariable ["lastUpdate",time];
_object setVariable ["ObjectID", _idKey, true];
_object setVariable ["ownerPUID", _ownerPUID, true];

_lockable = 0;
if(isNumber (configFile >> "CfgVehicles" >> _type >> "lockable")) then {
_lockable = getNumber(configFile >> "CfgVehicles" >> _type >> "lockable");
};

// fix for leading zero issues on safe codes after restart
if (_lockable == 4) then {
_codeCount = (count (toArray _ownerID));
if(_codeCount == 3) then {
_ownerID = format["0%1", _ownerID];
};
if(_codeCount == 2) then {
_ownerID = format["00%1", _ownerID];
};
if(_codeCount == 1) then {
_ownerID = format["000%1", _ownerID];
};
};

if (_lockable == 3) then {
_codeCount = (count (toArray _ownerID));
if(_codeCount == 2) then {
_ownerID = format["0%1", _ownerID];
};
if(_codeCount == 1) then {
_ownerID = format["00%1", _ownerID];
};
};

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

clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
// _object setVehicleAmmo DZE_vehicleAmmo;

_object setdir _dir;
if(_vecExists)then{
_object setVectorDirAndUp _vector;
};
_object setposATL _pos;
_object setDamage _damage;

if ((typeOf _object) in dayz_allowedObjects) then {
_object setVariable["memDir",_dir,true];
if (DZE_GodModeBase) then {
_object addEventHandler ["HandleDamage", {false}];
} else {
_object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
};
// Test disabling simulation server side on buildables only.
_object enableSimulation false;
// used for inplace upgrades && lock/unlock of safe
_object setVariable ["OEMPos", _pos, true];

};

if (count _intentory > 0) then {
if (_type in DZE_LockedStorage) then {
// Fill variables with loot
_object setVariable ["WeaponCargo", (_intentory select 0),true];
_object setVariable ["MagazineCargo", (_intentory select 1),true];
_object setVariable ["BackpackCargo", (_intentory select 2),true];
} else {

//Add weapons
_objWpnTypes = (_intentory select 0) select 0;
_objWpnQty = (_intentory select 0) select 1;
_countr = 0;
{
if(_x in (DZE_REPLACE_WEAPONS select 0)) then {
_x = (DZE_REPLACE_WEAPONS select 1) select ((DZE_REPLACE_WEAPONS select 0) find _x);
};
_isOK = isClass(configFile >> "CfgWeapons" >> _x);
if (_isOK) then {
_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} count _objWpnTypes;

//Add Magazines
_objWpnTypes = (_intentory select 1) select 0;
_objWpnQty = (_intentory select 1) select 1;
_countr = 0;
{
if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
if (_x == "ItemTent") then { _x = "ItemTentOld" };
_isOK = isClass(configFile >> "CfgMagazines" >> _x);
if (_isOK) then {
_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} count _objWpnTypes;

//Add Backpacks
_objWpnTypes = (_intentory select 2) select 0;
_objWpnQty = (_intentory select 2) select 1;
_countr = 0;
{
_isOK = isClass(configFile >> "CfgVehicles" >> _x);
if (_isOK) then {
_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
};
_countr = _countr + 1;
} count _objWpnTypes;
};
};

if (_object isKindOf "AllVehicles") then {
{
_selection = _x select 0;
_dam = _x select 1;
if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
[_object,_selection,_dam] call object_setFixServer;
} count _hitpoints;

_object setFuel _fuel;

if (!((typeOf _object) in dayz_allowedObjects)) then {

//_object setvelocity [0,0,1];
_object call fnc_veh_ResetEH;

if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
_object setvehiclelock "locked";
};

_totalvehicles = _totalvehicles + 1;

// total each vehicle
serverVehicleCounter set [count serverVehicleCounter,_type];
};
};

//Monitor the object
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
};
} count _objectArray;
// # END SPAWN OBJECTS #

// preload server traders menu data into cache
if !(DZE_ConfigTrader) then {
{
// get tids
_traderData = call compile format["menu_%1;",_x];
if (!isNil "_traderData") then {
{
_traderid = _x select 1;
//_key = format["CHILD:399:%1:",_traderid];
_key = format["\cache\traders\%1.sqf", _traderid];
diag_log ("LOAD TRADER: "+_key);
_res = preprocessFile _key;

if ((_res == "") or (isNil "_res")) then {
diag_log ("TRADER NOT FOUND");
} else {
call compile format["ServerTcache_%1 = [];", _traderid];

_retrader = call compile _res;
diag_log format["Count: %1", str(count _retrader)];

{
call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]", _traderid, _x];
} forEach _retrader;

_retrader = nil;
};
_res = nil;

} forEach (_traderData select 0);
};
} forEach serverTraders;
};

// spawn_vehicles
_vehLimit = MaxVehicleLimit - _totalvehicles;
if (_vehLimit > 0) then {
diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));
for "_x" from 1 to _vehLimit do {
[] spawn spawn_vehicles;
};
} else {
diag_log "HIVE: Vehicle Spawn limit reached!";
};

// spawn_roadblocks
diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));
for "_x" from 1 to MaxDynamicDebris do {
[] spawn spawn_roadblocks;
};
// spawn_ammosupply at server start 1% of roadblocks
diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));
for "_x" from 1 to MaxAmmoBoxes do {
[] spawn spawn_ammosupply;
};
// call spawning mining veins
diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));
for "_x" from 1 to MaxMineVeins do {
[] spawn spawn_mineveins;
};

if(isnil "dayz_MapArea") then {
dayz_MapArea = 10000;
};
if(isnil "HeliCrashArea") then {
HeliCrashArea = dayz_MapArea / 2;
};
if(isnil "OldHeliCrash") then {
OldHeliCrash = false;
};

// [_guaranteedLoot, _randomizedLoot, _frequency, _variance, _spawnChance, _spawnMarker, _spawnRadius, _spawnFire, _fadeFire]
if(OldHeliCrash) then {
_nul = [3, 4, (50 * 60), (15 * 60), 0.75, 'center', HeliCrashArea, true, false] spawn server_spawnCrashSite;
};

if (isDedicated) then {
// Epoch Events
_id = [] spawn server_spawnEvents;
// server cleanup
[] spawn {
private ["_id"];
sleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
waitUntil {!isNil "server_spawnCleanAnimals"};
_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
};

// spawn debug box
_debugMarkerPosition = getMarkerPos "respawn_west";
_debugMarkerPosition = [(_debugMarkerPosition select 0),(_debugMarkerPosition select 1),1];
_vehicle_0 = createVehicle ["DebugBox_DZ", _debugMarkerPosition, [], 0, "CAN_COLLIDE"];
_vehicle_0 setPos _debugMarkerPosition;
_vehicle_0 setVariable ["ObjectID","1",true];

// max number of spawn markers
if(isnil "spawnMarkerCount") then {
spawnMarkerCount = 10;
};
actualSpawnMarkerCount = 0;
// count valid spawn marker positions
for "_i" from 0 to spawnMarkerCount do {
if (!([(getMarkerPos format["spawn%1", _i]), [0,0,0]] call BIS_fnc_areEqual)) then {
actualSpawnMarkerCount = actualSpawnMarkerCount + 1;
} else {
// exit since we did not find any further markers
_i = spawnMarkerCount + 99;
};

};
diag_log format["Total Number of spawn locations %1", actualSpawnMarkerCount];

endLoadingScreen;
};

// WAI missions
[] ExecVM "\z\addons\dayz_server\WAI\init.sqf";

call compile preprocessFileLineNumbers "\z\addons\dayz_server\DZAI\init\dzai_initserver.sqf";

// DZMS missions
//[] ExecVM "\z\addons\dayz_server\DZMS\DZMSInit.sqf";

allowConnection = true;
sm_done = true;
publicVariable "sm_done";
};

Link to comment
Share on other sites

I added in Precise Base Building (by Mikeeeyy) and now get the following when i place a metal floor (This works just fine even after server restart)

20:39:05 "CHILD:308:24:MetalFloor_DZ:0:374:["268.449341","[6640.998535,6746.262695,0.252735]"]:[]:[]:0:66410674633268:"

But adding Vectorbuild back in with Precise Base Building yields the following

21:10:06 "CHILD:308:24:MetalFloor_DZ:0:374:["268.449005","[6640.967285,6746.262207,-0.0214729]",[[-0.994158,-0.0269185,0.104528],[0.10449,0.00282924,0.994522]]]:[]:[]:0:66410674632276:"

Just an observation here but is Vectorbuild supposed to populate the :[]:[]: section of the CHILD:308 code?

 

20:39:05 "CHILD:308:24:MetalFloor_DZ:0:374:["268.449341","[6640.998535,6746.262695,0.252735]"]:[]:[]:0:66410674633268:"

 

Full error in Dump.log (Linux version of RPT)

21:10:06 Error in expression <n;


_vecCnt = 0;
{
_set = _x;
{
_vecCnt = _vecCnt + (round (_x * 100));


} count>
21:10:06   Error position: <= _vecCnt + (round (_x * 100));


} count>
21:10:06   Error Type Number, expected Bool
21:10:06 File z\addons\dayz_server\init\server_functions.sqf, line 625
21:10:06 "CHILD:308:24:MetalFloor_DZ:0:374:["268.449005","[6640.967285,6746.262207,-0.0214729]",[[-0.994158,-0.0269185,0.104528],[0.10449,0.00282924,0.994522]]]:[]:[]:0:66410674632276:"

HIVE Message on startup 

21:12:59 "HIVE: Starting"
21:12:59 "HIVE: Local Time set to [2014,6,6,13,0]"
21:12:59 "LOAD OBJECTS"
21:12:59 Error in expression <]",[[-0.994158,-0.02,[],[],0.000,0.000]]>
21:12:59   Error position: <>
21:12:59   Error Missing ]
21:12:59 Error in expression <]",[[-0.994158,-0.02,[],[],0.000,0.000]]>
21:12:59   Error position: <>
21:12:59   Error Missing ]
21:12:59 "FOUND  OBJECTS"
21:12:59 "LOAD TRADER: \cache\traders\478.sqf"
21:12:59 Error in expression <og format["FOUND %1 OBJECTS", str(count _objectArray)];




_totalvehicles = 0;
{
>
21:12:59   Error position: <_objectArray)];




_totalvehicles = 0;
{
>
21:12:59   Error Undefined variable in expression: _objectarray
21:12:59 File z\addons\dayz_server\system\server_monitor.sqf, line 61
 
Link to comment
Share on other sites

Hi man, 

 

I am using the Build Vectors with Snap Building Pro 1.4.1 with AdminBuild and Plot 4 Life and lately have started seeing a few weird things. Garage doors that have been flipped onto their sides sometimes disappear. Say there are two, side by side, to form a HUGE double garage door. Not always, but sometimes after a restart the left one is missing. I will replace it and then after restart the right one might be missing. So I will replace that. Then after another restart the left one is missing again? 

Also, we have been starting to see little gaps appearing in walls where they join, like this :

 

 

2014-12-14_00001_zps02d2cbee.jpg

 

 

2014-12-14_00003_zps79df1f1e.jpg

Any idea what could be causing these issues? I can see nothing in any log that might be of concern and it's really starting to bug me.

 

Thanks 

Link to comment
Share on other sites

Hi man, 

 

I am using the Build Vectors with Snap Building Pro 1.4.1 with AdminBuild and Plot 4 Life and lately have started seeing a few weird things. Garage doors that have been flipped onto their sides sometimes disappear. Say there are two, side by side, to form a HUGE double garage door. Not always, but sometimes after a restart the left one is missing. I will replace it and then after restart the right one might be missing. So I will replace that. Then after another restart the left one is missing again? 

Also, we have been starting to see little gaps appearing in walls where they join, like this :

 

 

2014-12-14_00001_zps02d2cbee.jpg

 

 

2014-12-14_00003_zps79df1f1e.jpg

Any idea what could be causing these issues? I can see nothing in any log that might be of concern and it's really starting to bug me.

 

Thanks 

for the gaps issue, did you also add the Precise Base Building? Precise Base Building was built specifically to fix that issue.

Link to comment
Share on other sites

Whenever i build double doors (cinder), the frame saves to the database and as soon as i add the door to the thing the row gets deleted and after a server restart it gets deleted, also cannot add combo locks to them.

 

Edit: Although i can build non-rotated garage doors.

Link to comment
Share on other sites

Whenever i build double doors (cinder), the frame saves to the database and as soon as i add the door to the thing the row gets deleted and after a server restart it gets deleted, also cannot add combo locks to them.

Edit: Although i can build non-rotated garage doors.

Are u getting the its not setup yet error?

Link to comment
Share on other sites

Getting these 2 in my client rpt yet everything seems to be working fine, used V4 installation and files

 

i have P4L, Snap Pro, Plot/Door and Group Management installed

Error in expression <Array = [_cancel,_reason,_position,_dir,_vector];
_passArray 
>
  Error position: <_vector];
_passArray 
>
  Error Undefined variable in expression: _vector
File mpmissions\__CUR_MP.Chernarus\Custom\A_Plot_for_Life\Action\player_build_controls.sqf, line 224
Error in expression <text, _isPole, _lockable,_dir, _reason, _vector] call player_build_publish;
};
}>
  Error position: <_vector] call player_build_publish;
};
}>
  Error Undefined variable in expression: _vector
File mpmissions\__CUR_MP.Chernarus\Custom\A_Plot_for_Life\Action\modular_build.sqf, line 91
Link to comment
Share on other sites

Whenever i build double doors (cinder), the frame saves to the database and as soon as i add the door to the thing the row gets deleted and after a server restart it gets deleted, also cannot add combo locks to them.

 

Edit: Although i can build non-rotated garage doors.

 

This is exactly the drama I am having at the moment.

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...