Jump to content

striker

Member
  • Posts

    132
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by striker

  1. Good Evening,

     

    first of thanks for the great script.

    sadly i have a issue with the script, maybe someone can help.

     

    Fresh Install (In this order)

    -infistar

    -pp4l

    -snap pro

    -build vectors

     

    Here the Problem:

    Before I installed Vectors I had the Take Ownership menu available.

    Now that I integrated Vectors the option Take Ownership fails to show up.

    The script nonetheless works perfectly just this one option is missing.

     

    I tried to the best of my abilities (apparently not good enough) to merge the files but in the end

    sadly it has not worked. Can you point me in the right direction.

     

    Currently I have my Fresh Install ready with 

    infistar

    pp4l

    snap pro

     

    I have read all 18 pages and found no topic regarding this, i am sorry if i have missed the topic.

    Best Regards,

    Huppabubba

    (HungEmmaoLP is allowing me to use his username as mine has not been cleared yet)

     

    Hello,

     

    Put your old self_actions.sqf back into the mission file and see if that solves that issue. If it does, search for player_upgrade.sqf and change to path accordingly.

     

    striker

  2. This is an extremely ALPHA project and by no means is appropriate for production servers! ONLY FOR DEVELOPMENT SERVERS (when released)

     

    Hey guys,

    Intro

    Just want to share with you my latest project that I have been working on. One of the biggest issues I have seen with running a server is low fps do to the shear amount of objects in the server. I pondered on how I could solve this issue. One of the first games to pop into my head was Minecraft. Why is Minecraft significant? It's significant because the size the levels can be can practically be unlimited to the average person, and the way they achieve this is, well, level chunks. So I decided I would take this concept and apply it to the object spawning mechanism.

     

    The Mechanism

    The way dayz currently spawns in objects is it spawns everything in at once when the server starts. This creates lower FPS on the client side because the clients have to account for all of those vehicles. The way I have reworked the mechanism is to put all the objects into an array for later access. I get the chuck the players are in by using a function that divides their location by the chunk size. This in turn, creates a array location which can also get the objects within their chunk. You can also apply a chunk radius which will be added and subtracted from the current chunks location. This is done to prevent only one chunk to load at once.

     

    Benchmark

    Here is a few screen shots of the script in action and then without the script. This is on a public server with less than a thousand objects on the server. (FPS in upper right hand corner)

     

    With chunk script

    ArmA2OA+2014-12-07+16-36-03-48.png

    ArmA2OA+2014-12-07+16-35-01-43.png

     

    Without chunk script

    ArmA2OA+2014-12-07+16-41-58-69.png

    ArmA2OA+2014-12-07+16-43-45-08.png

    Result: As you can see from the pictures, rural areas on the map, FPS increase is close to +20, while on the city side of the spectrum, FPS increase is a mere +5 FPS.

     

    But that is not where the script is suppose to shine... What if I told you we could have 10,000 object on the server with a decent FPS? Lets try it at 2,000 vehicles first shall we  ;)

     

    With chunk script

    ArmA2OA+2014-12-07+17-09-36-75.png

     

    Without chunk script

    ArmA2OA+2014-12-07+17-33-59-19.png

     

    Result: Yep, chunks helped tremendously with the FPS of the client. It's FPS was a shear +38 fps more and there was 2,000 vehicles.

     

    The performance increase is great but there still is a long road(network lag) ahead of the script.

     

    Any thoughts? Should I continue with it? IS IT THE FUTURE?

     

    Ill share the script once I have it to an exceptionable point. However, if there is a massive influx of people who want to see it for themselves, I might release what I have now.

     

     

     

     

    Appreciate and support my work? btn_donate_LG.gif

  3. anyone any idea why this dont seem to do anything for me??

     

    heres my player build  http://pastebin.com/H6xzyA2s

     

    and added this to my init amongst the other configs

    //build vectors
    DZE_noRotate = ["ItemWoodLadder"]; //Objects that cannot be rotated. Ex: DZE_noRotate = ["VaultStorageLocked"]
    DZE_curPitch = 45; //Starting rotation angle. Only 1, 5, 45, or 90.
    

    thanks for awesome script

     

     

    Hey, 

    The array works by the built classname of the object, so:

    DZE_noRotate = ["ItemWoodLadder"];
    

    Should be

    DZE_noRotate = ["WoodLadder_DZ"];
    

    striker

  4. Hey Ree,

     

    Ill look into the RPT errors more, as for this issue:

     

     

    It may be the lack of sleep but as i was posting this i noticed u use _intentory and not _inventory in your server_monitor.sqf i'll change that in mine and see if it fix's the first error

     

    In the 1.0.5.1 release of the server_monitor.sqf, there was a spelling error of the word _inventory, that is why it is _intentory. If you fixed that spelling error in your files, than changing it may help.

     

    striker

  5. *Droolz* I needed this but let me get this right because config details feel little light

     

    /*

    select 0 = Prevent gear from spawning on locked vehicles (boolean)

    select 1 = Guaranteed loot piles (int)

    select 2 = Max additional loot piles on top of guaranteed (int)

    select 3 = Radius around crash site to spawn loot (double or int)

    select 4 = Chance of gear being destroyed (Between 0-1, Ex: 0 = Never lost, 0.5 = Half lost, 1 = All lost)

    Default: DZE_crashLootConfig = [true,2,5,5,0];

    */

     

    select 0 =  Locked vehicles Will not drop Loot ("Default: True") 

    select 1 = The Amount of Loot Piles around destroyed vehicles ("Default: 2") out of Max amount ___?  "Max Safe Amount" 

    select 2 =  Max additional loot piles On top of select 1 loot Piles  ("Default: 5")  out of Max amount ___?  "Max Safe Amount" 

    select 3 =  Radius around crash site to drop loot ("Default: 5")m out of Max amount ___?  "Max Safe Amount" 

    select 4 = Chance of gear being destroyed (Between 0-1, Ex: 0 = Never lost, 0.5 = Half lost, 1 = All lost)

     

    So if i do 

     

    DZE_crashLootConfig = [false,10,5,10,0];

     

    [false,       Items Will drop even if Vehicle is locked

    10,           the amount of loot piles around destroyed vehicles is 10 that's if Vehicle has that much loot

    5,             is the amount of piles on top of the default loot piles "Does this number need to be greater then select 1?

    10,           the loot will be dropped with in 10m of the destroyed vehicle or is it 1 to 10m letting it pick from random from 1 thru 10

    0,             all drops

     

    Sorry for the question i tryed it out on default and loved it but i just want to know if those setting i have there will make it look more spread out like stuff got flung around. Anymore details would be great =)

     

    Thank you 

    Re

     

     

    Everything is setup like how you have it in the script, so anywhere between 10 and 15 weapon holders will spawn. However, how the script is set up now, it will choose from 1 to 10-15. I have to re-script the mechanism to put at least one thing in each and then go random after that to get the desired effects. As for the radius, it should be anywhere from 0-10 meters from the wreck, however, it might not be. If it is a constant 10 meters from the wreck, try this fix.

     

    Where it says:

    _temp = createVehicle ["WeaponHolder", [_pos select 0, _pos select 1, 0], [], _radius, "CAN_COLLIDE"];
    

    Change to:

    _temp = createVehicle ["WeaponHolder", [_pos select 0, _pos select 1, 0], [], (random _radius), "CAN_COLLIDE"];
    

    As for the rest, you are correct.  :)

     

    striker

  6. So what happens to helis when they blow up in flight for example? Or if you crash and then it blows up? Dose the loot float down to the ground or is this only for land vehicles.

    Sorry will check this out when I get back looks great either way

     

    Ill actually check that out myself too, I do have a speed check as shown below, but for some reason I do not think it works as planned.

    	_count = 0;
    	while{(speed _veh) > 0.1 && _count <= 20} do{
    		sleep 0.1;
    		_count = _count + 0.1;
    	}; 

    Thanks for bringing that up!

     

    striker

  7. I replaced my server_crashLoot.sqf to the latest. What else do i need to change. Hive Infistar vehicles still dont work. even the trader ones dont

     

    Alright, remove everything done to server_functions.sqf, no longer need to use this file for the script. Should just need to remove the following from the file:

    	if(_unit isKindOf "AllVehicles") then{
    		//execVM instead of function so we can sleep
    		_unit execVM "\z\addons\dayz_server\compile\server_crashLoot.sqf";
    	};
    

    Remove all the addMPEventHandlers you added from ALL THE FILES. They should look like the one below

    _object addMPEventHandler ["MPKilled",{_this call object_handleServerKilled;}];
    

    Open up server_updateObject.sqf and search for

     

    _object_killed = {
    	private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    

    Add the following under it

    	if(_object isKindOf "AllVehicles") then{
    		//execVM instead of function so we can sleep
    		_object execVM "\z\addons\dayz_server\compile\server_crashLoot.sqf";
    	};
    
  8. Oops, sorry - forgot that one...

     

     

    scriptName "Functions\misc\fn_selfActions.sqf";

    /***********************************************************

    ADD ACTIONS FOR SELF

    - Function

    - [] call fnc_usec_selfActions;

    ************************************************************/

    private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_isModularDoor","_ownerKeyName","_temp_keys_names","_OpenClose","_unit","_Build","_clothesTaken","_open","_houses","_garages","_obj"];

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

    _vehicle = vehicle player;

    _isPZombie = player isKindOf "PZombie_VB";

    _inVehicle = (_vehicle != player);

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

    _canDo = (!r_drag_sqf && !r_player_unconscious && !_onLadder);

    _nearLight = nearestObject [player,"LitObject"];

    _canPickLight = false;

    if (!isNull _nearLight) then {

    if (_nearLight distance player < 4) then {

    _canPickLight = isNull (_nearLight getVariable ["owner",objNull]);

    };

    };

    //OriginsDoors

    if(isNil "s_player_openhouse") then {

    s_player_openhouse = -1;

    };

    if(isNil "HouseState") then {

    HouseState = 0;

    };

    if(isNil "GarageState") then {

    GarageState = 0;

    };

    if(isNil "s_player_opengarage") then {

    s_player_opengarage = -1;

    };

    _houses = ["Uroven1DrevenaBudka", "Uroven2KladaDomek", "Uroven3DrevenyDomek", "Uroven1VelkaBudka", "Uroven2MalyDomek", "Uroven3VelkyDomek"];

    _garages = ["malaGaraz", "velkaGaraz","Uroven3DrevenyDomek","Uroven3VelkyDomek","kingramida"];

    DoorToOpen = objnull;

    _obj = player;

    _cursorTarget = cursorTarget;

    if (!isNull _cursorTarget) then {

    if (player distance _cursorTarget < 10) then {

    _ownerID = _cursorTarget getVariable['CharacterID','0'];

    if (getPlayerUIDOld player == _ownerID) then {

    DoorToOpen = _cursorTarget;

    if (s_player_openhouse < 0) then {

    if(typeOf(DoorToOpen) in _houses) then {

    _OpenClose = "";

    if (_cursorTarget isKindOf "Uroven1DrevenaBudka") then { _OpenClose = 'Unlock Bandit Level 1 House';};

    if (_cursorTarget isKindOf "Uroven2KladaDomek") then { _OpenClose = 'Unlock Bandit Level 2 House';};

    if (_cursorTarget isKindOf "Uroven3DrevenyDomek") then { _OpenClose = 'Unlock Bandit Level 3 House';};

    if (_cursorTarget isKindOf "Uroven1VelkaBudka") then { _OpenClose = 'Unlock Hero Level 1 House';};

    if (_cursorTarget isKindOf "Uroven2MalyDomek") then { _OpenClose = 'Unlock Hero Level 2 House';};

    if (_cursorTarget isKindOf "Uroven3VelkyDomek") then { _OpenClose = 'Unlock Hero Level 3 House';};

    if (HouseState == 1) then {

    _OpenClose = "";

    if (_cursorTarget isKindOf "Uroven1DrevenaBudka") then { _OpenClose = 'Lock Bandit Level 1 House';};

    if (_cursorTarget isKindOf "Uroven2KladaDomek") then { _OpenClose = 'Lock Bandit Level 2 House';};

    if (_cursorTarget isKindOf "Uroven3DrevenyDomek") then { _OpenClose = 'Lock Bandit Level 3 House';};

    if (_cursorTarget isKindOf "Uroven1VelkaBudka") then { _OpenClose = 'Lock Hero Level 1 House';};

    if (_cursorTarget isKindOf "Uroven2MalyDomek") then { _OpenClose = 'Lock Hero Level 2 House';};

    if (_cursorTarget isKindOf "Uroven3VelkyDomek") then { _OpenClose = 'Lock Hero Level 3 House';};

    };

    s_player_openhouse = player addAction [_OpenClose, 'Origins\originsHouses.sqf'];

    };

    };

    if (s_player_opengarage < 0) then

    {

    if(typeOf(DoorToOpen) in _garages) then {

    _OpenClose = "";

    if (_cursorTarget isKindOf "malaGaraz") then { _OpenClose = 'Unlock Small Garage';};

    if (_cursorTarget isKindOf "velkaGaraz") then { _OpenClose = 'Unlock Large Garage';};

    if (_cursorTarget isKindOf "Uroven3DrevenyDomek") then { _OpenClose = 'Unlock Level 3 Garage';};

    if (_cursorTarget isKindOf "Uroven3VelkyDomek") then { _OpenClose = 'Unlock Level 3 Garage';};

    if (_cursorTarget isKindOf "kingramida") then { _OpenClose = 'Unlock Pyramid';};

    if (GarageState == 1) then {

    _OpenClose = "";

    if (_cursorTarget isKindOf "malaGaraz") then { _OpenClose = 'Lock Small Garage';};

    if (_cursorTarget isKindOf "velkaGaraz") then { _OpenClose = 'Lock Large Garage';};

    if (_cursorTarget isKindOf "Uroven3DrevenyDomek") then { _OpenClose = 'Lock Level 3 Garage';};

    if (_cursorTarget isKindOf "Uroven3VelkyDomek") then { _OpenClose = 'Lock Level 3 Garage';};

    if (_cursorTarget isKindOf "kingramida") then { _OpenClose = 'Lock Pyramid';};

    };

    s_player_opengarage = player addAction [_OpenClose, 'Origins\originsGarages.sqf'];

    };

    };

    };

    };

    };

    if ((_obj != player) || (_cursorTarget != cursorTarget)) then {

    _obj removeAction s_player_openhouse;

    _obj removeAction s_player_opengarage;

    s_player_openhouse = -1;

    s_player_opengarage = -1;

    };

    /*

    //Submarine

    if (_inVehicle and (_vehicle isKindOf "ori_submarine")) then {

    if (sub_up < 0) then {

    thesub = _vehicle;

    sub_down = thesub addAction ["Rise","scripts\submarine\sub_down.sqf","",5,false,true];

    sub_up = thesub addAction ["Submerge","scripts\submarine\sub_up.sqf","",5,false,true];

    };

    } else {

    thesub removeAction sub_up;

    sub_up = -1;

    thesub removeAction sub_down;

    sub_down = -1;

    };

    //

    */

    // ====================== IT's SERVER MENU SCRIPT V1.5.2 ======================

    // CUSTOMIZATION:

    // The color for the menu is customizable. Default: f2cb0b. If you want to change it, use HTML color codes. Google it.

    // IMPORTANT: If you have an antihack running like infiSTAR.de's their AH then add these names to the allowed actions list:

    // s_player_servermenu,s_player_servermenu1,s_player_servermenu2,s_player_servermenu3,s_player_servermenu4,s_player_servermenuCancel,

    // IT07's Server Menu script

    if((speed player <= 1) && _canDo) then {

    if (s_player_servermenu < 0) then {

    s_player_servermenu = player addAction [("" + ("Rules, Tips, and Help - Read Me!") +""),"scripts\OnLineHelp\IT_Modules\menuLauncher.sqf","",-1,false,false,"", ""];

    };

    } else {

    player removeAction s_player_servermenu;

    s_player_servermenu = -1;

    player removeAction s_player_servermenu1;

    player removeAction s_player_servermenu2;

    player removeAction s_player_servermenu3;

    player removeAction s_player_servermenu4;

    player removeAction s_player_servermenuCancel;

    };

    // ====================== SERVER MENU SCRIPT END ====================== //

    //Grab Flare

    if (_canPickLight && !dayz_hasLight && !_isPZombie) then {

    if (s_player_grabflare < 0) then {

    _text = getText (configFile >> "CfgAmmo" >> (typeOf _nearLight) >> "displayName");

    s_player_grabflare = player addAction [format[localize "str_actions_medical_15",_text], "\z\addons\dayz_code\actions\flare_pickup.sqf",_nearLight, 1, false, true, "", ""];

    s_player_removeflare = player addAction [format[localize "str_actions_medical_17",_text], "\z\addons\dayz_code\actions\flare_remove.sqf",_nearLight, 1, false, true, "", ""];

    };

    } else {

    player removeAction s_player_grabflare;

    player removeAction s_player_removeflare;

    s_player_grabflare = -1;

    s_player_removeflare = -1;

    };

    //-----------------------SUV and MV22 START-------------------------------------------------------------

    if (_inVehicle && (_vehicle isKindOf "MV22")) then {

    if (isEngineOn _vehicle) then {[_vehicle,0] call mv22_pack;};

    if (mv22_fold < 0) then {

    themv22 = _vehicle;

    if !(isEngineOn themv22) then {

    mv22_fold = themv22 addAction ["Fold","Scripts\animate\mv22_fold.sqf","",5,false,true];

    mv22_unfold = themv22 addAction ["UnFold","Scripts\animate\mv22_unfold.sqf","",5,false,true];

    mv22_open = themv22 addAction ["Open Ramp","Scripts\animate\mv22_open.sqf","",5,false,true];

    mv22_close = themv22 addAction ["Close Ramp","Scripts\animate\mv22_close.sqf","",5,false,true];

    };

    };

    if (isEngineOn themv22) then {

    themv22 removeAction mv22_fold;

    mv22_fold = -1;

    themv22 removeAction mv22_unfold;

    mv22_unfold = -1;

    themv22 removeAction mv22_open;

    mv22_open = -1;

    themv22 removeAction mv22_close;

    mv22_close = -1;

    };

    } else {

    if (!isNil "themv22") then {

    themv22 removeAction mv22_fold;

    mv22_fold = -1;

    themv22 removeAction mv22_unfold;

    mv22_unfold = -1;

    themv22 removeAction mv22_open;

    mv22_open = -1;

    themv22 removeAction mv22_close;

    mv22_close = -1;

    };

    };

    if (_inVehicle && (_vehicle isKindOf "ArmoredSUV_Base_PMC")) then {

    if ((_vehicle animationPhase "HideGun_01") == 1) then {

    _unit = _vehicle turretUnit [0];

    if (!(isNull _unit)) then {

    _unit action ["moveToCargo",_vehicle,2];

    titleText ["\n\nYou must open the hatch first.","PLAIN DOWN"];titleFadeOut 4;

    };

    };

    if (suv_close < 0) then {

    thesuv = _vehicle;

    suv_close = thesuv addAction ["Close Hatch","Scripts\animate\suv_close.sqf","",5,false,true];

    suv_open = thesuv addAction ["Open Hatch","Scripts\animate\suv_open.sqf","",5,false,true];

    };

    } else {

    if (!isNil "thesuv") then {

    thesuv removeAction suv_close;

    suv_close = -1;

    thesuv removeAction suv_open;

    suv_open = -1;

    };

    };

    if(DZE_HaloJump) then {

    if(_inVehicle && (_vehicle isKindOf "Air") && ((([_vehicle] call FNC_getPos) select 2) > 400)) then {

    if (s_halo_action < 0) then {

    DZE_myHaloVehicle = _vehicle;

    s_halo_action = DZE_myHaloVehicle addAction [localize "STR_EPOCH_ACTIONS_HALO","\z\addons\dayz_code\actions\halo_jump.sqf",[],2,false,true,"",""];

    };

    } else {

    DZE_myHaloVehicle removeAction s_halo_action;

    s_halo_action = -1;

    };

    };

    if (!DZE_ForceNameTagsOff) then {

    if (s_player_showname < 0 && !_isPZombie) then {

    if (DZE_ForceNameTags) then {

    s_player_showname = 1;

    player setVariable["DZE_display_name",true,true];

    } else {

    s_player_showname = player addAction [localize "STR_EPOCH_ACTIONS_NAMEYES", "\z\addons\dayz_code\actions\display_name.sqf",true, 0, true, false, "",""];

    s_player_showname1 = player addAction [localize "STR_EPOCH_ACTIONS_NAMENO", "\z\addons\dayz_code\actions\display_name.sqf",false, 0, true, false, "",""];

    };

    };

    };

    if(_isPZombie) then {

    if (s_player_callzombies < 0) then {

    s_player_callzombies = player addAction [localize "STR_EPOCH_ACTIONS_RAISEHORDE", "\z\addons\dayz_code\actions\call_zombies.sqf",player, 5, true, false, "",""];

    };

    if (DZE_PZATTACK) then {

    call pz_attack;

    DZE_PZATTACK = false;

    };

    if (s_player_pzombiesvision < 0) then {

    s_player_pzombiesvision = player addAction [localize "STR_EPOCH_ACTIONS_NIGHTVIS", "\z\addons\dayz_code\actions\pzombie\pz_vision.sqf", [], 4, false, true, "nightVision", "_this == _target"];

    };

    if (!isNull cursorTarget && (player distance cursorTarget < 3)) then { //Has some kind of target

    _isAnimal = cursorTarget isKindOf "Animal";

    _isZombie = cursorTarget isKindOf "zZombie_base";

    _isHarvested = cursorTarget getVariable["meatHarvested",false];

    _isMan = cursorTarget isKindOf "Man";

    // Pzombie Gut human corpse || animal

    if (!alive cursorTarget && (_isAnimal || _isMan) && !_isZombie && !_isHarvested) then {

    if (s_player_pzombiesfeed < 0) then {

    s_player_pzombiesfeed = player addAction [localize "STR_EPOCH_ACTIONS_FEED", "\z\addons\dayz_code\actions\pzombie\pz_feed.sqf",cursorTarget, 3, true, false, "",""];

    };

    } else {

    player removeAction s_player_pzombiesfeed;

    s_player_pzombiesfeed = -1;

    };

    } else {

    player removeAction s_player_pzombiesfeed;

    s_player_pzombiesfeed = -1;

    };

    };

    // Increase distance only if AIR || SHIP

    _allowedDistance = 4;

    _isAir = cursorTarget isKindOf "Air";

    _isShip = cursorTarget isKindOf "Ship";

    if(_isAir || _isShip) then {

    _allowedDistance = 8;

    };

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

    // set cursortarget to variable

    _cursorTarget = cursorTarget;

    // get typeof cursortarget once

    _typeOfCursorTarget = typeOf _cursorTarget;

    // hintsilent _typeOfCursorTarget;

    _isVehicle = _cursorTarget isKindOf "AllVehicles";

    _isVehicletype = _typeOfCursorTarget in ["ATV_US_EP1","ATV_CZ_EP1"];

    _isnewstorage = _typeOfCursorTarget in DZE_isNewStorage;

    // get items && magazines only once

    _magazinesPlayer = magazines player;

    //boiled Water

    _hasbottleitem = "ItemWaterbottle" in _magazinesPlayer;

    _hastinitem = false;

    {

    if (_x in _magazinesPlayer) then {

    _hastinitem = true;

    };

    } count boil_tin_cans;

    _hasFuelE = "ItemJerrycanEmpty" in _magazinesPlayer;

    _hasFuelBarrelE = "ItemFuelBarrelEmpty" in _magazinesPlayer;

    _hasHotwireKit = "ItemHotwireKit" in _magazinesPlayer;

    _itemsPlayer = items player;

    _temp_keys = [];

    _temp_keys_names = [];

    // find available keys

    _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];

    {

    if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {

    _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");

    _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");

    _temp_keys_names set [_ownerKeyId,_ownerKeyName];

    _temp_keys set [count _temp_keys,str(_ownerKeyId)];

    };

    } count _itemsPlayer;

    _hasKnife = "ItemKnife" in _itemsPlayer;

    _hasToolbox = "ItemToolbox" in _itemsPlayer;

    _isMan = _cursorTarget isKindOf "Man";

    _traderType = _typeOfCursorTarget;

    _ownerID = _cursorTarget getVariable ["CharacterID","0"];

    _isAnimal = _cursorTarget isKindOf "Animal";

    _isDog = (_cursorTarget isKindOf "DZ_Pastor" || _cursorTarget isKindOf "DZ_Fin");

    _isZombie = _cursorTarget isKindOf "zZombie_base";

    _isDestructable = _cursorTarget isKindOf "BuiltItems";

    _isWreck = _typeOfCursorTarget in DZE_isWreck;

    _isWreckBuilding = _typeOfCursorTarget in DZE_isWreckBuilding;

    _isModular = _cursorTarget isKindOf "ModularItems";

    _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ"];

    _isRemovable = _typeOfCursorTarget in DZE_isRemovable;

    _isDisallowRepair = _typeOfCursorTarget in ["M240Nest_DZ"];

    _isTent = _cursorTarget isKindOf "TentStorage";

    _isAlive = alive _cursorTarget;

    _text = getText (configFile >> "CfgVehicles" >> _typeOfCursorTarget >> "displayName");

    _rawmeat = meatraw;

    _hasRawMeat = false;

    {

    if (_x in _magazinesPlayer) then {

    _hasRawMeat = true;

    };

    } count _rawmeat;

    _isFuel = false;

    if (_hasFuelE || _hasFuelBarrelE) then {

    {

    if(_cursorTarget isKindOf _x) exitWith {_isFuel = true;};

    } count dayz_fuelsources;

    };

    // diag_log ("OWNERID = " + _ownerID + " CHARID = " + dayz_characterID + " " + str(_ownerID == dayz_characterID));

    // logic vars

    _player_flipveh = false;

    _player_deleteBuild = false;

    _player_lockUnlock_crtl = false;

    if (_canDo && (speed player <= 1) && (_cursorTarget isKindOf "Plastic_Pole_EP1_DZ")) then {

    if (s_player_maintain_area < 0) then {

    s_player_maintain_area = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", "maintain", 5, false];

    s_player_maintain_area_preview = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", "preview", 5, false];

    };

    } else {

    player removeAction s_player_maintain_area;

    s_player_maintain_area = -1;

    player removeAction s_player_maintain_area_preview;

    s_player_maintain_area_preview = -1;

    };

    // CURSOR TARGET ALIVE

    if(_isAlive) then {

    //Allow player to delete objects

    if(_isDestructable || _isWreck || _isRemovable || _isWreckBuilding) then {

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

    _player_deleteBuild = true;

    };

    };

    //Allow owners to delete modulars

    if(_isModular && (dayz_characterID == _ownerID)) then {

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

    _player_deleteBuild = true;

    };

    };

    //Allow owners to delete modular doors without locks

    if(_isModularDoor && (dayz_characterID == _ownerID)) then {

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

    _player_deleteBuild = true;

    };

    };

    // CURSOR TARGET VEHICLE

    if(_isVehicle) then {

    //flip vehicle small vehicles by your self && all other vehicles with help nearby

    if (!(canmove _cursorTarget) && (player distance _cursorTarget >= 2) && (count (crew _cursorTarget))== 0 && ((vectorUp _cursorTarget) select 2) < 0.5) then {

    _playersNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]);

    if(_isVehicletype || (_playersNear >= 2)) then {

    _player_flipveh = true;

    };

    };

    if(!_isMan && _ownerID != "0" && !(_cursorTarget isKindOf "Bicycle")) then {

    _player_lockUnlock_crtl = true;

    };

    };

    };

    if(_player_deleteBuild) then {

    if (s_player_deleteBuild < 0) then {

    s_player_deleteBuild = player addAction [format[localize "str_actions_delete",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];

    };

    } else {

    player removeAction s_player_deleteBuild;

    s_player_deleteBuild = -1;

    };

    /* if (DZE_HeliLift) then {

    _liftHeli = objNull;

    _found = false;

    _allowTow = false;

    if ((count (crew _cursorTarget)) == 0) then {

    {

    if(!_allowTow) then {

    _allowTow = _cursorTarget isKindOf _x;

    };

    } count DZE_HeliAllowToTow;

    };

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

    if (_allowTow) then {

    _liftHelis = nearestObjects [player, DZE_HeliAllowTowFrom, 15];

    {

    if(!_found) then {

    _posL = [_x] call FNC_getPos;

    _posC = [_cursorTarget] call FNC_getPos;

    _height = (_posL select 2) - (_posC select 2);

    _hasAttached = _x getVariable["hasAttached",false];

    if(_height < 15 && _height > 5 && (typeName _hasAttached != "OBJECT")) then {

    if(((abs((_posL select 0) - (_posC select 0))) < 10) && ((abs((_posL select 1) - (_posC select 1))) < 10)) then {

    _liftHeli = _x;

    _found = true;

    };

    };

    };

    } count _liftHelis;

    };

    */

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

    /* _attached = _cursorTarget getVariable["attached",false];

    if(_found && _allowTow && _canDo && !locked _cursorTarget && !_isPZombie && (typeName _attached != "OBJECT")) then {

    if (s_player_heli_lift < 0) then {

    s_player_heli_lift = player addAction ["Attach to Heli", "\z\addons\dayz_code\actions\player_heliLift.sqf",[_liftHeli,_cursorTarget], -10, false, true, "",""];

    };

    } else {

    player removeAction s_player_heli_lift;

    s_player_heli_lift = -1;

    };

    };

    */

    // Allow Owner to lock && unlock vehicle

    if(_player_lockUnlock_crtl) then {

    if (s_player_lockUnlock_crtl < 0) then {

    _hasKey = _ownerID in _temp_keys;

    _oldOwner = (_ownerID == dayz_playerUID);

    if(locked _cursorTarget) then {

    if(_hasKey || _oldOwner) then {

    _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _ownerID))], 2, true, true, "", ""];

    s_player_lockunlock set [count s_player_lockunlock,_Unlock];

    s_player_lockUnlock_crtl = 1;

    } else {

    if(_hasHotwireKit) then {

    _Unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_HOTWIRE",_text], "\z\addons\dayz_code\actions\hotwire_veh.sqf",_cursorTarget, 2, true, true, "", ""];

    } else {

    _Unlock = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_VEHLOCKED"], "",_cursorTarget, 2, true, true, "", ""];

    };

    s_player_lockunlock set [count s_player_lockunlock,_Unlock];

    s_player_lockUnlock_crtl = 1;

    };

    } else {

    if(_hasKey || _oldOwner) then {

    _lock = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\lock_veh.sqf",_cursorTarget, 1, true, true, "", ""];

    s_player_lockunlock set [count s_player_lockunlock,_lock];

    s_player_lockUnlock_crtl = 1;

    };

    };

    };

    } else {

    {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];

    s_player_lockUnlock_crtl = -1;

    };

    //--------------------------------------ARREST----------------------------------------------------------------

    _Build = canbuild;

    if ((player getVariable"humanity") >= 5000) then {

    if(_isMan && !_isZombie && _canDo && _isAlive && _Build) then {

    if (s_player_arrest < 0) then {

    s_player_arrest = player addaction ['' + "Investigation Menu" + '', "scripts\Investigation\investigation.sqf","",100,false,true,"", ""];

    };

    } else {

    player removeAction s_player_arrest;

    s_player_arrest = -1;

    };

    };

    //-------------------------------------------------------------------------------------------------------------

    if(DZE_AllowForceSave) then {

    //Allow player to force save

    if((_isVehicle || _isTent) && !_isMan) then {

    if (s_player_forceSave < 0) then {

    s_player_forceSave = player addAction [format[localize "str_actions_save",_text], "\z\addons\dayz_code\actions\forcesave.sqf",_cursorTarget, 1, true, true, "", ""];

    };

    } else {

    player removeAction s_player_forceSave;

    s_player_forceSave = -1;

    };

    };

    If(DZE_AllowCargoCheck) then {

    if((_isVehicle || _isTent || _isnewstorage) && _isAlive && !_isMan && !locked _cursorTarget) then {

    if (s_player_checkGear < 0) then {

    s_player_checkGear = player addAction [localize "STR_EPOCH_PLAYER_CARGO", "\z\addons\dayz_code\actions\cargocheck.sqf",_cursorTarget, 1, true, true, "", ""];

    };

    } else {

    player removeAction s_player_checkGear;

    s_player_checkGear = -1;

    };

    };

    /* //flip vehicle small vehicles by your self && all other vehicles with help nearby

    if(_player_flipveh) then {

    if (s_player_flipveh < 0) then {

    s_player_flipveh = player addAction [format[localize "str_actions_flipveh",_text], "\z\addons\dayz_code\actions\player_flipvehicle.sqf",_cursorTarget, 1, true, true, "", ""];

    };

    } else {

    player removeAction s_player_flipveh;

    s_player_flipveh = -1;

    };

    */

    //Allow player to fill jerrycan

    if((_hasFuelE || _hasFuelBarrelE) && _isFuel) then {

    if (s_player_fillfuel < 0) then {

    s_player_fillfuel = player addAction [localize "str_actions_self_10", "\z\addons\dayz_code\actions\jerry_fill.sqf",[], 1, false, true, "", ""];

    };

    } else {

    player removeAction s_player_fillfuel;

    s_player_fillfuel = -1;

    };

    // logic vars for addactions

    _player_butcher = false;

    _player_studybody = false;

    _player_SurrenderedGear = false;

    // CURSOR TARGET NOT ALIVE

    if (!_isAlive) then {

    // Gut animal/zed

    if((_isAnimal || _isZombie) && _hasKnife) then {

    _isHarvested = _cursorTarget getVariable["meatHarvested",false];

    if (!_isHarvested) then {

    _player_butcher = true;

    };

    };

    // Study body

    if (_isMan && !_isZombie && !_isAnimal) then {

    _player_studybody = true;

    }

    } else {

    // unit alive

    // gear access on surrendered player

    if(_isMan && !_isZombie && !_isAnimal) then {

    _isSurrendered = _cursorTarget getVariable ["DZE_Surrendered",false];

    if (_isSurrendered) then {

    _player_SurrenderedGear = true;

    };

    };

    };

    // Human Gut animal || zombie

    if (_player_butcher) then {

    if (s_player_butcher < 0) then {

    if(_isZombie) then {

    s_player_butcher = player addAction [localize "STR_EPOCH_ACTIONS_GUTZOM", "\z\addons\dayz_code\actions\gather_zparts.sqf",_cursorTarget, 0, true, true, "", ""];

    } else {

    s_player_butcher = player addAction [localize "str_actions_self_04", "\z\addons\dayz_code\actions\gather_meat.sqf",_cursorTarget, 3, true, true, "", ""];

    };

    };

    } else {

    player removeAction s_player_butcher;

    s_player_butcher = -1;

    };

    // Study Body

    if (_player_studybody) then {

    if (s_player_studybody < 0) then {

    s_player_studybody = player addAction [localize "str_action_studybody", "\z\addons\dayz_code\actions\study_body.sqf",_cursorTarget, 0, false, true, "",""];

    };

    } else {

    player removeAction s_player_studybody;

    s_player_studybody = -1;

    };

    // logic vars

    _player_cook = false;

    _player_boil = false;

    // Take Clothes by Zabn

    player removeAction s_player_clothes;

    s_player_clothes = -1;

    //CLOTHES

    _clothesTaken = _cursorTarget getVariable["clothesTaken",false];

    // Take clothes by Zabn

    if (_isMan and !_isAlive and !_isZombie and !_clothesTaken) then {

    if (s_player_clothes < 0) then {

    s_player_clothes = player addAction [("")+("Take Clothes")+(""), "custom\player_takeClothes.sqf",[_cursorTarget], -10, false, true, "",""];

    };

    } else {

    player removeAction s_player_clothes;

    s_player_clothes = -1;

    };

    // CURSOR TARGET IS FIRE

    if (inflamed _cursorTarget) then {

    //Fireplace Actions check

    if (_hasRawMeat) then {

    _player_cook = true;

    };

    // Boil water

    if (_hasbottleitem && _hastinitem) then {

    _player_boil = true;

    };

    };

    if (_player_SurrenderedGear) then {

    if (s_player_SurrenderedGear < 0) then {

    s_player_SurrenderedGear = player addAction [localize "STR_EPOCH_ACTIONS_GEAR", "\z\addons\dayz_code\actions\surrender_gear.sqf",_cursorTarget, 1, true, true, "", ""];

    };

    } else {

    player removeAction s_player_SurrenderedGear;

    s_player_SurrenderedGear = -1;

    };

    //Fireplace Actions check

    if (_player_cook) then {

    if (s_player_cook < 0) then {

    s_player_cook = player addAction [localize "str_actions_self_05", "\z\addons\dayz_code\actions\cook.sqf",_cursorTarget, 3, true, true, "", ""];

    };

    } else {

    player removeAction s_player_cook;

    s_player_cook = -1;

    };

    // Boil water

    if (_player_boil) then {

    if (s_player_boil < 0) then {

    s_player_boil = player addAction [localize "str_actions_boilwater", "\z\addons\dayz_code\actions\boil.sqf",_cursorTarget, 3, true, true, "", ""];

    };

    } else {

    player removeAction s_player_boil;

    s_player_boil = -1;

    };

    if(_cursorTarget == dayz_hasFire) then {

    if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {

    s_player_fireout = player addAction [localize "str_actions_self_06", "\z\addons\dayz_code\actions\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];

    };

    } else {

    player removeAction s_player_fireout;

    s_player_fireout = -1;

    };

    //Packing my tent

    if(_isTent && (player distance _cursorTarget < 3)) then {

    if (_ownerID == dayz_characterID) then {

    if (s_player_packtent < 0) then {

    s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];

    };

    } else {

    if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {

    if (s_player_packtent < 0) then {

    s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];

    };

    };

    };

    } else {

    player removeAction s_player_packtent;

    s_player_packtent = -1;

    };

    //Allow owner to unlock vault

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

    if (s_player_unlockvault < 0) then {

    if(_typeOfCursorTarget in DZE_LockedStorage) then {

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

    _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];

    s_player_combi set [count s_player_combi,_combi];

    } else {

    _combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];

    s_player_combi set [count s_player_combi,_combi];

    };

    s_player_unlockvault = 1;

    } else {

    if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {

    _combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];

    s_player_combi set [count s_player_combi,_combi];

    s_player_unlockvault = 1;

    };

    };

    };

    } else {

    {player removeAction _x} count s_player_combi;s_player_combi = [];

    s_player_unlockvault = -1;

    };

    //Allow owner to pack vault

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

    if (s_player_lockvault < 0) then {

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

    s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true, "",""];

    };

    };

    if (s_player_packvault < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {

    s_player_packvault = player addAction [format["%1",(format[localize "STR_EPOCH_ACTIONS_PACK",_text])], "\z\addons\dayz_code\actions\vault_pack.sqf",_cursorTarget, 0, false, true, "",""];

    };

    } else {

    player removeAction s_player_packvault;

    s_player_packvault = -1;

    player removeAction s_player_lockvault;

    s_player_lockvault = -1;

    };

    //Player Deaths

    if(_typeOfCursorTarget == "Info_Board_EP1") then {

    if (s_player_information < 0) then {

    s_player_information = player addAction [localize "STR_EPOCH_ACTIONS_MURDERS", "\z\addons\dayz_code\actions\list_playerDeaths.sqf",[], 7, false, true, "",""];

    };

    } else {

    player removeAction s_player_information;

    s_player_information = -1;

    };

    //Fuel Pump

    if(_typeOfCursorTarget in dayz_fuelpumparray) then {

    if (s_player_fuelauto < 0) then {

    // check if Generator_DZ is running within 30 meters

    _findNearestGens = nearestObjects [player, ["Generator_DZ"], 30];

    _findNearestGen = [];

    {

    if (alive _x && (_x getVariable ["GeneratorRunning", false])) then {

    _findNearestGen set [(count _findNearestGen),_x];

    };

    } count _findNearestGens;

    _IsNearRunningGen = count (_findNearestGen);

    // show that pump needs power if no generator nearby.

    if(_IsNearRunningGen > 0) then {

    s_player_fuelauto = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",objNull, 0, false, true, "",""];

    } else {

    s_player_fuelauto = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];

    };

    };

    } else {

    player removeAction s_player_fuelauto;

    s_player_fuelauto = -1;

    };

    //Fuel Pump on truck

    if(_typeOfCursorTarget in DZE_fueltruckarray && alive _cursorTarget) then {

    if (s_player_fuelauto2 < 0) then {

    // show that fuel truck pump needs power.

    if(isEngineOn _cursorTarget) then {

    s_player_fuelauto2 = player addAction [localize "STR_EPOCH_ACTIONS_FILLVEH", "\z\addons\dayz_code\actions\fill_nearestVehicle.sqf",_cursorTarget, 0, false, true, "",""];

    } else {

    s_player_fuelauto2 = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_NEEDPOWER"], "",[], 0, false, true, "",""];

    };

    };

    } else {

    player removeAction s_player_fuelauto2;

    s_player_fuelauto2 = -1;

    };

    // inplace upgrade tool

    if ((_cursorTarget isKindOf "ModularItems") || (_cursorTarget isKindOf "Land_DZE_WoodDoor_Base") || (_cursorTarget isKindOf "CinderWallDoor_DZ_Base")) then {

    if ((s_player_lastTarget select 0) != _cursorTarget) then {

    if (s_player_upgrade_build > 0) then {

    player removeAction s_player_upgrade_build;

    s_player_upgrade_build = -1;

    };

    };

    if (s_player_upgrade_build < 0) then {

    // s_player_lastTarget = _cursorTarget;

    s_player_lastTarget set [0,_cursorTarget];

    s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];

    };

    } else {

    player removeAction s_player_upgrade_build;

    s_player_upgrade_build = -1;

    };

    // downgrade system

    if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {

    if ((s_player_lastTarget select 1) != _cursorTarget) then {

    if (s_player_downgrade_build > 0) then {

    player removeAction s_player_downgrade_build;

    s_player_downgrade_build = -1;

    };

    };

    if (s_player_downgrade_build < 0) then {

    s_player_lastTarget set [1,_cursorTarget];

    s_player_downgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_REMLOCK",_text], "\z\addons\dayz_code\actions\player_buildingDowngrade.sqf",_cursorTarget, -2, false, true, "",""];

    };

    } else {

    player removeAction s_player_downgrade_build;

    s_player_downgrade_build = -1;

    };

    //Allow owner to change Door code

    if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {

    if ((s_player_lastTarget select 1) != _cursorTarget) then {

    if (s_player_ckc > 0) then {

    player removeAction s_player_ckc;

    s_player_ckc = -1;

    };

    };

    if (s_player_ckc < 0) then {

    s_player_lastTarget set [1,_cursorTarget];

    s_player_ckc = player addaction["Set new Code", "ckc\ckc_startUI.sqf","",0,false,true,"", ""];

    };

    } else {

    player removeAction s_player_ckc;

    s_player_ckc = -1;

    };

    //Allow owner to change vault code

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

    if (s_player_Safe_ckc < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {

    s_player_Safe_ckc = player addaction["Set new Code", "ckc\ckc_startSafeUI.sqf","",0,false,true,"", ""];

    };

    } else {

    player removeAction s_player_Safe_ckc;

    s_player_Safe_ckc = -1;

    };

    // inplace maintenance tool

    if((_cursorTarget isKindOf "ModularItems" || _cursorTarget isKindOf "DZE_Housebase" || _typeOfCursorTarget == "LightPole_DZ") && (damage _cursorTarget >= DZE_DamageBeforeMaint)) then {

    if ((s_player_lastTarget select 2) != _cursorTarget) then {

    if (s_player_maint_build > 0) then {

    player removeAction s_player_maint_build;

    s_player_maint_build = -1;

    };

    };

    if (s_player_maint_build < 0) then {

    s_player_lastTarget set [2,_cursorTarget];

    s_player_maint_build = player addAction [format[localize "STR_EPOCH_ACTIONS_MAINTAIN",_text], "\z\addons\dayz_code\actions\player_buildingMaint.sqf",_cursorTarget, -2, false, true, "",""];

    };

    } else {

    player removeAction s_player_maint_build;

    s_player_maint_build = -1;

    };

    //Start Generator

    if(_cursorTarget isKindOf "Generator_DZ") then {

    if (s_player_fillgen < 0) then {

    // check if not running

    if((_cursorTarget getVariable ["GeneratorRunning", false])) then {

    s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR1", "\z\addons\dayz_code\actions\stopGenerator.sqf",_cursorTarget, 0, false, true, "",""];

    } else {

    // check if not filled && player has jerry.

    if((_cursorTarget getVariable ["GeneratorFilled", false])) then {

    s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR2", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];

    } else {

    if("ItemJerrycan" in _magazinesPlayer) then {

    s_player_fillgen = player addAction [localize "STR_EPOCH_ACTIONS_GENERATOR3", "\z\addons\dayz_code\actions\fill_startGenerator.sqf",_cursorTarget, 0, false, true, "",""];

    };

    };

    };

    };

    } else {

    player removeAction s_player_fillgen;

    s_player_fillgen = -1;

    };

    //Towing with tow truck - commented out to not conflict with mf-tow

    /*

    if(_typeOfCursorTarget == "TOW_DZE") then {

    if (s_player_towing < 0) then {

    if(!(_cursorTarget getVariable ["DZEinTow", false])) then {

    s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true, "",""];

    } else {

    s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true, "",""];

    };

    };

    } else {

    player removeAction s_player_towing;

    s_player_towing = -1;

    };

    */

    // MF-Tow Script by Matt Fairbrass (matt_d_rat)

    call compile preprocessFileLineNumbers "scripts\mf-tow\init.sqf";

    //Sleep

    if(_isTent && _ownerID == dayz_characterID) then {

    if ((s_player_sleep < 0) && (player distance _cursorTarget < 3)) then {

    s_player_sleep = player addAction [localize "str_actions_self_sleep", "custom\player_sleep.sqf",_cursorTarget, 0, false, true, "",""];

    };

    } else {

    player removeAction s_player_sleep;

    s_player_sleep = -1;

    };

    //Repairing Vehicles

    if ((dayz_myCursorTarget != _cursorTarget) && _isVehicle && !_isMan && _hasToolbox && (damage _cursorTarget < 1) && !_isDisallowRepair) then {

    if (s_player_repair_crtl < 0) then {

    dayz_myCursorTarget = _cursorTarget;

    _menu = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_REPAIRV", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];

    _menu1 = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_SALVAGEV", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];

    s_player_repairActions set [count s_player_repairActions,_menu];

    s_player_repairActions set [count s_player_repairActions,_menu1];

    s_player_repair_crtl = 1;

    } else {

    {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];

    s_player_repair_crtl = -1;

    };

    };

    // All Traders

    if (_isMan && !_isPZombie && _traderType in serverTraders) then {

    if (s_player_parts_crtl < 0) then {

    // get humanity

    _humanity = player getVariable ["humanity",0];

    _traderMenu = call compile format["menu_%1;",_traderType];

    // diag_log ("TRADER = " + str(_traderMenu));

    _low_high = "low";

    _humanity_logic = false;

    if((_traderMenu select 2) == "friendly") then {

    _humanity_logic = (_humanity < -5000);

    };

    if((_traderMenu select 2) == "hostile") then {

    _low_high = "high";

    _humanity_logic = (_humanity > -5000);

    };

    if((_traderMenu select 2) == "hero") then {

    _humanity_logic = (_humanity < 5000);

    };

    if(_humanity_logic) then {

    _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];

    s_player_parts set [count s_player_parts,_cancel];

    } else {

    // Static Menu

    {

    //diag_log format["DEBUG TRADER: %1", _x];

    _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true, "",""];

    s_player_parts set [count s_player_parts,_buy];

    } count (_traderMenu select 1);

    // Database menu

    _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false, "",""];

    s_player_parts set [count s_player_parts,_buy];

    };

    s_player_parts_crtl = 1;

    };

    } else {

    {player removeAction _x} count s_player_parts;s_player_parts = [];

    s_player_parts_crtl = -1;

    };

    if(dayz_tameDogs) then {

    //Dog

    if (_isDog && _isAlive && (_hasRawMeat) && _ownerID == "0" && player getVariable ["dogID", 0] == 0) then {

    if (s_player_tamedog < 0) then {

    s_player_tamedog = player addAction [localize "str_actions_tamedog", "\z\addons\dayz_code\actions\tame_dog.sqf", _cursorTarget, 1, false, true, "", ""];

    };

    } else {

    player removeAction s_player_tamedog;

    s_player_tamedog = -1;

    };

    if (_isDog && _ownerID == dayz_characterID && _isAlive) then {

    _dogHandle = player getVariable ["dogID", 0];

    if (s_player_feeddog < 0 && _hasRawMeat) then {

    s_player_feeddog = player addAction [localize "str_actions_feeddog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,0], 0, false, true,"",""];

    };

    if (s_player_waterdog < 0 && "ItemWaterbottle" in _magazinesPlayer) then {

    s_player_waterdog = player addAction [localize "str_actions_waterdog","\z\addons\dayz_code\actions\dog\feed.sqf",[_dogHandle,1], 0, false, true,"",""];

    };

    if (s_player_staydog < 0) then {

    _lieDown = _dogHandle getFSMVariable "_actionLieDown";

    if (_lieDown) then { _text = "str_actions_liedog"; } else { _text = "str_actions_sitdog"; };

    s_player_staydog = player addAction [localize _text,"\z\addons\dayz_code\actions\dog\stay.sqf", _dogHandle, 5, false, true,"",""];

    };

    if (s_player_trackdog < 0) then {

    s_player_trackdog = player addAction [localize "str_actions_trackdog","\z\addons\dayz_code\actions\dog\track.sqf", _dogHandle, 4, false, true,"",""];

    };

    if (s_player_barkdog < 0) then {

    s_player_barkdog = player addAction [localize "str_actions_barkdog","\z\addons\dayz_code\actions\dog\speak.sqf", _cursorTarget, 3, false, true,"",""];

    };

    if (s_player_warndog < 0) then {

    _warn = _dogHandle getFSMVariable "_watchDog";

    if (_warn) then { _text = (localize "str_epoch_player_247"); _warn = false; } else { _text = (localize "str_epoch_player_248"); _warn = true; };

    s_player_warndog = player addAction [format[localize "str_actions_warndog",_text],"\z\addons\dayz_code\actions\dog\warn.sqf",[_dogHandle, _warn], 2, false, true,"",""];

    };

    if (s_player_followdog < 0) then {

    s_player_followdog = player addAction [localize "str_actions_followdog","\z\addons\dayz_code\actions\dog\follow.sqf",[_dogHandle,true], 6, false, true,"",""];

    };

    } else {

    player removeAction s_player_feeddog;

    s_player_feeddog = -1;

    player removeAction s_player_waterdog;

    s_player_waterdog = -1;

    player removeAction s_player_staydog;

    s_player_staydog = -1;

    player removeAction s_player_trackdog;

    s_player_trackdog = -1;

    player removeAction s_player_barkdog;

    s_player_barkdog = -1;

    player removeAction s_player_warndog;

    s_player_warndog = -1;

    player removeAction s_player_followdog;

    s_player_followdog = -1;

    };

    };

    } else {

    //Engineering

    {dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];

    s_player_repair_crtl = -1;

    // thesub = -1; //submarine

    {player removeAction _x} count s_player_combi;s_player_combi = [];

    dayz_myCursorTarget = objNull;

    s_player_lastTarget = [objNull,objNull,objNull,objNull,objNull];

    {player removeAction _x} count s_player_parts;s_player_parts = [];

    s_player_parts_crtl = -1;

    {player removeAction _x} count s_player_lockunlock;s_player_lockunlock = [];

    s_player_lockUnlock_crtl = -1;

    player removeAction s_player_checkGear;

    s_player_checkGear = -1;

    player removeAction s_player_SurrenderedGear;

    s_player_SurrenderedGear = -1;

    //VehickeKeyChanger

    player removeAction s_player_claimVehicle;

    s_player_claimVehicle = -1;

    //Others

    player removeAction s_player_forceSave;

    s_player_forceSave = -1;

    player removeAction s_player_flipveh;

    s_player_flipveh = -1;

    player removeAction s_player_sleep;

    s_player_sleep = -1;

    player removeAction s_player_deleteBuild;

    s_player_deleteBuild = -1;

    player removeAction s_player_butcher;

    s_player_butcher = -1;

    player removeAction s_player_cook;

    s_player_cook = -1;

    player removeAction s_player_boil;

    s_player_boil = -1;

    player removeAction s_player_fireout;

    s_player_fireout = -1;

    player removeAction s_player_packtent;

    s_player_packtent = -1;

    player removeAction s_player_fillfuel;

    s_player_fillfuel = -1;

    player removeAction s_player_studybody;

    s_player_studybody = -1;

    //Dog

    player removeAction s_player_tamedog;

    s_player_tamedog = -1;

    player removeAction s_player_feeddog;

    s_player_feeddog = -1;

    player removeAction s_player_waterdog;

    s_player_waterdog = -1;

    player removeAction s_player_staydog;

    s_player_staydog = -1;

    player removeAction s_player_trackdog;

    s_player_trackdog = -1;

    player removeAction s_player_barkdog;

    s_player_barkdog = -1;

    player removeAction s_player_warndog;

    s_player_warndog = -1;

    player removeAction s_player_followdog;

    s_player_followdog = -1;

    // vault

    player removeAction s_player_unlockvault;

    s_player_unlockvault = -1;

    player removeAction s_player_packvault;

    s_player_packvault = -1;

    player removeAction s_player_lockvault;

    s_player_lockvault = -1;

    player removeAction s_player_information;

    s_player_information = -1;

    player removeAction s_player_fillgen;

    s_player_fillgen = -1;

    player removeAction s_player_upgrade_build;

    s_player_upgrade_build = -1;

    player removeAction s_player_maint_build;

    s_player_maint_build = -1;

    player removeAction s_player_downgrade_build;

    s_player_downgrade_build = -1;

    player removeAction s_player_ckc;

    s_player_ckc = -1;

    player removeAction s_player_Safe_ckc;

    s_player_Safe_ckc = -1;

    player removeAction s_player_towing;

    s_player_towing = -1;

    player removeAction s_player_fuelauto;

    s_player_fuelauto = -1;

    player removeAction s_player_fuelauto2;

    s_player_fuelauto2 = -1;

    //Service Points

    // SP_refuel_action = -1;

    // SP_repair_action = -1;

    // SP_rearm_actions = [];

    //Arrest

    player removeAction s_player_arrest;

    s_player_arrest = -1;

    player removeAction s_player_release;

    s_player_release = -1;

    player removeAction s_player_escort;

    s_player_escort = -1;

    player removeAction s_player_search;

    s_player_search = -1;

    };

    //Dog actions on player self

    _dogHandle = player getVariable ["dogID", 0];

    if (_dogHandle > 0) then {

    _dog = _dogHandle getFSMVariable "_dog";

    _ownerID = "0";

    if (!isNull cursorTarget) then { _ownerID = cursorTarget getVariable ["CharacterID","0"]; };

    if (_canDo && !_inVehicle && alive _dog && _ownerID != dayz_characterID) then {

    if (s_player_movedog < 0) then {

    s_player_movedog = player addAction [localize "str_actions_movedog", "\z\addons\dayz_code\actions\dog\move.sqf", player getVariable ["dogID", 0], 1, false, true, "", ""];

    };

    if (s_player_speeddog < 0) then {

    _text = (localize "str_epoch_player_249");

    _speed = 0;

    if (_dog getVariable ["currentSpeed",1] == 0) then { _speed = 1; _text = (localize "str_epoch_player_250"); };

    s_player_speeddog = player addAction [format[localize "str_actions_speeddog", _text], "\z\addons\dayz_code\actions\dog\speed.sqf",[player getVariable ["dogID", 0],_speed], 0, false, true, "", ""];

    };

    if (s_player_calldog < 0) then {

    s_player_calldog = player addAction [localize "str_actions_calldog", "\z\addons\dayz_code\actions\dog\follow.sqf", [player getVariable ["dogID", 0], true], 2, false, true, "", ""];

    };

    };

    } else {

    player removeAction s_player_movedog;

    s_player_movedog = -1;

    player removeAction s_player_speeddog;

    s_player_speeddog = -1;

    player removeAction s_player_calldog;

    s_player_calldog = -1;

    };

    //---------------------------------------------STRONGHOLD START---------------------------------------------------

    if((typeOf cursorTarget == "krepost") and (player distance cursorTarget < 23)) then {

    if (str1 < 0) then {

    if ((cursorTarget getVariable ["CharacterID","0"] == dayz_combination) or (cursorTarget getVariable ["CharacterID","0"] == dayz_playerUID)) then {

    str1 = player addAction [format[ "Open %1",getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName")], "scripts\build\stronghold\s_open.sqf",cursorTarget, 0, false, true];

    str2 = player addAction [format[ "Open interior doors",_text], "scripts\build\stronghold\s_openall.sqf",_cursorTarget, 0, false, true];

    str3 = player addAction [format[ "Close interior doors",_text], "scripts\build\stronghold\s_closeall.sqf",_cursorTarget, 0, false, true];

    str4 = player addAction [format[ "Lock %1",getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName")], "scripts\build\stronghold\s_lock.sqf",_cursorTarget, 0, false, true];

    _open set [count _open,5];

    } else {

    str1 = player addAction [format["Unlock %1",getText (configFile >> "CfgVehicles" >> typeOf cursorTarget >> "displayName")], "scripts\build\stronghold\s_unlock.sqf",cursorTarget, 0, false, true];

    _open set [count _open,1];

    };

    };

    } else {

    player removeAction str1;

    str1 = -1;

    player removeAction str2;

    str2 = -1;

    player removeAction str3;

    str3 = -1;

    player removeAction str4;

    str4 = -1;

    };

    //--------------------------------------------Stronghold END------------------------------------------------------------

    This line:

    s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "\z\addons\dayz_code\actions\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""];
    

    Needs to be change to:

    s_player_upgrade_build = player addAction [format[localize "STR_EPOCH_ACTIONS_UPGRADE",_text], "custom\player_upgrade.sqf",_cursorTarget, -1, false, true, "",""]; 

    or the path that you have it in.

     

    That should solve your issue.  ;)

     

    striker

  9. crashLootLogo2.png

     

    https://www.youtube.com/watch?v=nNbjP3EgBDI

     

    Description
         The purpose of this script is to scatter gear from player vehicles on the ground when they are destroyed. This script allows you to set many different settings to suit your needs. It runs mostly on the server side other than the config variable so you don't have to repack your PBO every time you want to make a change. You can enable or disable the script from spawning gear on the ground depending on if the vehicle is locked or not. This is a important one as it will prevent many people from going around and blowing up every vehicle they see  ;) You can also state the min and max loot piles that you want to spawn around the vehicle. You can also set the radius that the loot piles will spawn in creating a nice random look (don't judge the video). The file controllable element at your disposal is the ability to set the chance the gear will be destroyed. More detail will be given when we implement the config variable in the init.sqf. Without further ado, let the installation begin! :lol:

     

    WARNING: Only use vehicles spawned by the server to test to see if the script is working. Infistar spawned vehicles will not work (However, HIVE spawned might).
     
    Installation 

    Sever Side Script:

    Spoiler

    server_crashLoot.sqf

    Create a file named server_crashLoot.sqf in the compile folder of your dayz_server.pbo. (You actually put it where you want, you just need to change the file path)
    Once you have created the file, add the following code to it:

     

    
    private["_veh","_gear","_pos","_crashPile","_crashPiles","_element","_objWpnTypes","_objWpnQty","_isOK","_countr","_count","_cont","_temp","_rnd","_lockPrevent","_guaranteedLoot","_randomizedLoot","_radius","_chance"];
    _veh = _this;
    _gear = _veh getVariable ["lastInventory", []];
    
    if(isNil "DZE_crashLootConfig") then{
    	DZE_crashLootConfig = [true,2,5,5,0];
    };
    	
    _lockPrevent = DZE_crashLootConfig select 0;
    _guaranteedLoot = DZE_crashLootConfig select 1;
    _randomizedLoot = DZE_crashLootConfig select 2;
    _radius = DZE_crashLootConfig select 3;
    _chance = DZE_crashLootConfig select 4;
    
    _crashPile = objNull;
    _crashPiles = [];
    _cont = false;
    
    
    if(_lockPrevent) then{
    	if(locked _veh) then{
    		_cont = false;
    	}else{
    		_cont = true;
    	};
    }else{
    	_cont = true;
    };
    
    if(((count _gear) > 0) && _cont) then{
    	
    	//Wait for vehicle to stop moving
    	sleep 1;
    	_count = 0;
    	while{(speed _veh) > 0.1 && _count <= 20} do{
    		sleep 0.1;
    		_count = _count + 0.1;
    	};
    	
    	//Spawn the loot
    	diag_log format["DEAD VEHICLE - server_crashLoot.sqf - %1",_gear];
    	
    	_pos = getPos _veh;
    	_num = round(random _randomizedLoot) + _guaranteedLoot;
    
    	for "_x" from 1 to _num do {
    		_temp = createVehicle ["WeaponHolder", [_pos select 0, _pos select 1, 0], [], _radius, "CAN_COLLIDE"];
    		_crashPiles = _crashPiles + [_temp];
    	};
    	
    	//Add weapons
    	_objWpnTypes = (_gear select 0) select 0;
    	_objWpnQty = (_gear 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 {
    			_element = floor(random _num);
    			_crashPile = _crashPiles select _element;
    			for "_i" from 1 to (_objWpnQty select _countr) do {
    				_rnd = random 1;
    				if(_rnd >= _chance) then{
    					_crashPile addWeaponCargoGlobal [_x,1];
    				};
    			};
    		};
    		_countr = _countr + 1;
    	} count _objWpnTypes; 
    
    	//Add Magazines
    	_objWpnTypes = (_gear select 1) select 0;
    	_objWpnQty = (_gear 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 {
    			_element = floor(random _num);
    			_crashPile = _crashPiles select _element;
    			for "_i" from 1 to (_objWpnQty select _countr) do {
    				_rnd = random 1;
    				if(_rnd >= _chance) then{
    					_crashPile addMagazineCargoGlobal [_x,1];
    				};
    			};
    		};
    		_countr = _countr + 1;
    	} count _objWpnTypes;
    	
    	//Add Backpacks
    	_objWpnTypes = (_gear select 2) select 0;
    	_objWpnQty = (_gear select 2) select 1;
    	_countr = 0;
    	{
    		_isOK = 	isClass(configFile >> "CfgVehicles" >> _x);
    		if (_isOK) then {
    			_element = floor(random _num);
    			_crashPile = _crashPiles select _element;
    			for "_i" from 1 to (_objWpnQty select _countr) do {
    				_rnd = random 1;
    				if(_rnd >= _chance) then{
    					_crashPile addBackpackCargoGlobal [_x,1];
    				};
    			};
    		};
    		_countr = _countr + 1;
    	} count _objWpnTypes;
    };
    
    

    *This is the main file which handles checking requirements and spawning the gear on the ground.

     
    server_monitor.sqf

    Find the following line in the server_monitor.sqf:

    
    if (_object isKindOf "AllVehicles") then {
    

    And place the following after it:

    
    _object setVariable ["lastInventory", _intentory];
    

    *This sets the "lastInventory" to the gear that was saved to the database (prevents the crashLoot script from dropping nothing when there really is something).
     
    server_updateObject.sqf

    Find the following line in server_updateObject.sqf:

    
    _object setVariable["lastInventory",_inventory];
    

    And replace it with:

    
    	if(alive _object) then{
    		_object setVariable["lastInventory",_inventory];
    	};
    

    *This just makes sure that the "lastInventory" array isn't set back to nothing.

     

    Then find:

    
    _object_killed = {
    	private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    

    And place the following after it:

    
    	if(_object isKindOf "AllVehicles") then{
    		_object execVM "\z\addons\dayz_server\compile\server_crashLoot.sqf";
    	}; 

    *This calls the crashLoot script when vehicle is destroyed.

     
    server_publishVehicle.sqf, server_publishVehicle2.sqf, server_publishVehicle3.sqf

    In all three of these files find the following line:

    
    publicVariable "PVDZE_veh_Init";
    

    If the file is server_publishVehicle3.sqf add the following after that line:

    
    _object setVariable ["lastInventory", [_weapons,_magazines,_backpacks]];
    

    Else add the following after that line:

    
    _object setVariable ["lastInventory", []];
    

    *This adds the variable to the published vehicles.
     
    That completes the server side!  :)
     



    Mission Side Script:

    Spoiler


     
    init.sqf

    In the init.sqf, add the following near the top with the rest of the dayz variables:

    
    /*
    Revamped instructions by Ree
    select 0 =  Locked vehicles Will not drop Loot ("Default: True") 
    select 1 = The Amount of Loot Piles around destroyed vehicles ("Default: 2") out of Max amount ___?  "Max Safe Amount" 
    select 2 =  Max additional loot piles On top of select 1 loot Piles  ("Default: 5")  out of Max amount ___?  "Max Safe Amount" 
    select 3 =  Radius around crash site to drop loot ("Default: 5")m out of Max amount ___?  "Max Safe Amount" 
    select 4 = Chance of gear being destroyed (Between 0-1, Ex: 0 = Never lost, 0.5 = Half lost, 1 = All lost)
    Default: DZE_crashLootConfig = [true,2,5,5,0];
    */
    DZE_crashLootConfig = [true,2,5,5,0]; 

     
     


     

     

    Version 1 - initial release

    Version 1.1 (Complete) - change code to use the _object_killed funciton(overlooked that one <_<)

     

    Appreciate and support my work? btn_donate_LG.gif

  10. Sure,

     

    Here's 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"];

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

    DZE_ActionInProgress = true;

    player removeAction s_player_upgrade_build;

    s_player_upgrade_build = 1;

    _distance = 30;

    _needText = localize "str_epoch_player_246";

    // check for near plot

    _findNearestPoles = nearestObjects [(vehicle player), ["Plastic_Pole_EP1_DZ"], _distance];

    _findNearestPole = [];

    {

    if (alive _x) then {

    _findNearestPole set [(count _findNearestPole),_x];

    };

    } count _findNearestPoles;

    _IsNearPlot = count (_findNearestPole);

    _canBuildOnPlot = false;

    if(_IsNearPlot == 0) then {

    _canBuildOnPlot = true;

    } else {

    // check nearby plots ownership && then for friend status

    _nearestPole = _findNearestPole select 0;

    // Find owner

    _ownerID = _nearestPole getVariable["CharacterID","0"];

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

    // check if friendly to owner

    if(dayz_characterID == _ownerID) then {

    _canBuildOnPlot = true;

    } else {

    _friendlies = player getVariable ["friendlyTo",[]];

    // check if friendly to owner

    if(_ownerID in _friendlies) then {

    _canBuildOnPlot = true;

    };

    };

    };

    // exit if not allowed due to plot pole

    if(!_canBuildOnPlot) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "str_epoch_player_157"),_needText,_distance] , "PLAIN DOWN"]; };

    // get cursortarget from addaction

    _obj = _this select 3;

    // Find objectID

    _objectID = _obj getVariable ["ObjectID","0"];

    // Find objectUID

    _objectUID = _obj getVariable ["ObjectUID","0"];

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

    // Get classname

    _classname = typeOf _obj;

    // Find display name

    _text = getText (configFile >> "CfgVehicles" >> _classname >> "displayName");

    // Find next upgrade

    _upgrade = getArray (configFile >> "CfgVehicles" >> _classname >> "upgradeBuilding");

    if ((count _upgrade) > 0) then {

    _newclassname = _upgrade select 0;

    _lockable = 0;

    if(isNumber (configFile >> "CfgVehicles" >> _newclassname >> "lockable")) then {

    _lockable = getNumber(configFile >> "CfgVehicles" >> _newclassname >> "lockable");

    };

    _requirements = _upgrade select 1;

    _missingQty = 0;

    _missing = "";

    _proceed = true;

    {

    _itemIn = _x select 0;

    _countIn = _x select 1;

    _qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count magazines player;

    if(_qty < _countIn) exitWith { _missing = _itemIn; _missingQty = (_countIn - _qty); _proceed = false; };

    } forEach _requirements;

    if (_proceed) then {

    [1,1] call dayz_HungerThirst;

    player playActionNow "Medic";

    [player,20,true,(getPosATL player)] spawn player_alertZombies;

    _temp_removed_array = [];

    _removed_total = 0;

    _tobe_removed_total = 0;

    {

    _removed = 0;

    _itemIn = _x select 0;

    _countIn = _x select 1;

    // diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];

    _tobe_removed_total = _tobe_removed_total + _countIn;

    {

    if( (_removed < _countIn) && ((_x == _itemIn) || configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn)) then {

    _num_removed = ([player,_x] call BIS_fnc_invRemove);

    _removed = _removed + _num_removed;

    _removed_total = _removed_total + _num_removed;

    if(_num_removed >= 1) then {

    _temp_removed_array set [count _temp_removed_array,_x];

    };

    };

    } forEach magazines player;

    } forEach _requirements;

    // all parts removed proceed

    if (_tobe_removed_total == _removed_total) then {

    // Get position

    _location = _obj getVariable["OEMPos",(getposATL _obj)];

    // Get direction

    _dir = getDir _obj;

    //Get Vector

    _vector = [(vectorDir _obj),(vectorUp _obj)];

    // Current charID

    _objectCharacterID = _obj getVariable ["CharacterID","0"];

    _classname = _newclassname;

    // Create new object

    _object = createVehicle [_classname, [0,0,0], [], 0, "CAN_COLLIDE"];

    //#########################INDESTRUCTIBLE ITEMS#########################

    if ((typeOf _object) in indestructible) then {

    _object addEventHandler ["HandleDamage", {false}];

    _object enableSimulation false;

    };

    //######################################################################

    // Set direction

    _object setDir _dir;

    // Set vector

    _object setVectorDirAndUp _vector;

    // Set location

    _object setPosATL _location;

    if (_lockable == 3) then {

    _combination_1 = floor(random 10);

    _combination_2 = floor(random 10);

    _combination_3 = floor(random 10);

    _combination = format["%1%2%3",_combination_1,_combination_2,_combination_3];

    _objectCharacterID = _combination;

    cutText [format[(localize "str_epoch_player_158"),_combination,_text], "PLAIN DOWN", 5];

    } else {

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

    };

    PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location,_vector],_classname,_obj,player];

    publicVariableServer "PVDZE_obj_Swap";

    player reveal _object;

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

     

    Here's my cusom/compiles.sqf:

     

    //Custom Self Actions

    fnc_usec_selfActions = compile preprocessFileLineNumbers "custom\fn_selfActions.sqf";

    //No Idea

    player_removeObject = compile preprocessFileLineNumbers "custom\remove.sqf";

    //Snap Build

    player_build = compile preprocessFileLineNumbers "scripts\snap_pro\player_build.sqf";

    snap_build = compile preprocessFileLineNumbers "scripts\snap_pro\snap_build.sqf";

    dayz_spaceInterrupt = compile preprocessFileLineNumbers "custom\dayz_spaceInterrupt.sqf";

    player_lockVault = compile preprocessFileLineNumbers "custom\player_lockVault.sqf";

    player_unlockVault = compile preprocessFileLineNumbers "custom\player_unlockVault.sqf";

    //Maca's Right Click Feature

    player_selectSlot = compile preprocessFileLineNumbers "custom\ui_selectSlot.sqf";

    //LockUnlock for heli lift and tow

    local_lockUnlock = compile preprocessFileLineNumbers "scripts\mf-tow\local_lockUnlock.sqf";

    //Stuff

    call compile preprocessFileLineNumbers "custom\player_traderMenuHive.sqf";

    //Stronghold

    player_buildStronghold = compile preprocessFileLineNumbers "scripts\build\stronghold\s.sqf";

    //Code Changer

    ckc_button = compile preprocessFileLineNumbers "ckc\ckc_button.sqf";

    ckc_upddoor = compile preprocessFileLineNumbers "ckc\ckc_upddoor.sqf";

    ckc_updSafe = compile preprocessFileLineNumbers "ckc\ckc_updSafe.sqf";

    //SUV and MV22 Actions

    mv22_pack = compile preprocessFileLineNumbers "\ca\air2\mv22\scripts\pack.sqf";

    // Dayz Group Management

    player_switchModel = compile preprocessFileLineNumbers "custom\player_switchModel.sqf";

     

    Here's Server_functions.sqf:

     

    private ["_debug","_platform"];

    [] spawn {[] execVM "\z\addons\dayz_server\init\AH.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;

    };

    };

    BIS_Effects_Burn = {};

    server_playerCharacters = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerCharacters.sqf";

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

    _data = "HiveExt" callExtension _this;

    };

    server_hiveReadWrite = {

    private["_key","_resultArray","_data"];

    _key = _this;

    _data = "HiveExt" callExtension _key;

    _resultArray = call compile format ["%1",_data];

    _resultArray

    };

    server_hiveReadWriteLarge = {

    private["_key","_resultArray","_data"];

    _key = _this;

    _data = "HiveExt" callExtension _key;

    _resultArray = 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;

    _key = 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];

    _key call server_hiveWrite;

    };

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

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

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

    }else{

    if((count _this) == 3) then{

    if(typename (_this select 2) == "ARRAY")then{

    _vector = _this select 2;

    if(count _vector == 2)then{

    if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{

    _key = "";

    _position = _this select 1;

    {

    _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))

    } foreach _set;

    } foreach _vector;

    if(_vecCnt < 0)then{

    _vecCnt = ((_vecCnt * -1) * 3);

    };

    _key = _key + str(_vecCnt);

    }else{

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

    };

    }else{

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

    };

    }else{

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

    };

    }else{

    if((count _this) == 4) then{

    if(typename (_this select 3) == "ARRAY")then{

    _vector = _this select 3;

    if(count _vector == 2)then{

    if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{

    _key = "";

    _position = _this select 1;

    {

    _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))

    } foreach _set;

    } foreach _vector;

    if(_vecCnt < 0)then{

    _vecCnt = ((_vecCnt * -1) * 3);

    };

    _key = _key + str(_vecCnt);

    }else{

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

    };

    }else{

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

    };

    }else{

    if(typename (_this select 2) == "ARRAY")then{

    _vector = _this select 2;

    if(count _vector == 2)then{

    if(((count (_vector select 0)) == 3) && ((count (_vector select 1)) == 3))then{

    _key = "";

    _position = _this select 1;

    {

    _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))

    } foreach _set;

    } foreach _vector;

    if(_vecCnt < 0)then{

    _vecCnt = ((_vecCnt * -1) * 3);

    };

    _key = _key + str(_vecCnt);

    }else{

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

    };

    }else{

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

    };

    }else{

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

    };

    };

    }else{

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

    };

    };

    };

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

    _key = format["CHILD:103:%1:%2:%3:",_this select 0,_this select 1,_this select 2];

    _key call server_hiveWrite;

    };

    currentInvites = []; // for Dayz Group Management

    publicVariable "currentInvites"; // for Dayz Group Management

    // Enhanced Spawn Selection

    #include "ESSconfig.sqf"

    dayz_perform_purge = {

    private ["_group"];

    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","_group"];

    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 = {

    private ["_group"];

    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 = _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 {

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

    };

    };

    execVM "\z\addons\dayz_server\buildings\weedfarm.sqf";

    //Enhanced Spawn Selection

    execVM "\z\addons\dayz_server\init\ESSfloor.sqf";

    // Dayz Group Management

    execVM "\z\addons\dayz_server\init\broadcaster.sqf";

    //PrecisionBaseBuild

    KK_fnc_floatToString = {

    private "_arr";

    if (abs (_this - _this % 1) == 0) exitWith { str _this };

    _arr = toArray str abs (_this % 1);

    _arr set [0, 32];

    toString (toArray str (

    abs (_this - _this % 1) * _this / abs _this

    ) + _arr - [32])

    };

    KK_fnc_positionToString = {

    format [

    "[%1,%2,%3]",

    _this select 0 call KK_fnc_floatToString,

    _this select 1 call KK_fnc_floatToString,

    _this select 2 call KK_fnc_floatToString

    ]

    };

    _debug = getMarkerPos "respawn_west";

    _platform = createVehicle ["MetalFloor_DZ",[_debug select 0,_debug select 1,0.1],[],0,"CAN_COLLIDE"];

    _platform setVehicleInit "this allowDammage false;this enableSimulation false;";

    _platform allowDammage false;

    _platform enableSimulation false;

    if (surfaceIsWater _debug) then {_platform setPosASL [_debug select 0,_debug select 1,0.1];};

    processInitCommands;

     

    Here's server_monitor.sqf:

     

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

    ["_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)

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

    //Define arrays

    owner_B1 = [];

    owner_B2 = [];

    owner_B3 = [];

    owner_H1 = [];

    owner_H2 = [];

    owner_H3 = [];

    owner_SG = [];

    if (isServer && isNil "sm_done") then {

    serverVehicleCounter = [];

    _hiveResponse = [];

    for "_i" from 1 to 5 do {

    diag_log "HIVE: trying to get objects";

    _key = format["CHILD:302:%1:", dayZ_instance];

    _hiveResponse = _key call server_hiveReadWrite;

    if ((((isnil "_hiveResponse") || {(typeName _hiveResponse != "ARRAY")}) || {((typeName (_hiveResponse select 1)) != "SCALAR")})) then {

    if ((_hiveResponse select 1) == "Instance already initialized") then {

    _superkey = profileNamespace getVariable "SUPERKEY";

    _shutdown = format["CHILD:400:%1:", _superkey];

    _res = _shutdown call server_hiveReadWrite;

    diag_log ("HIVE: attempt to kill.. HiveExt response:"+str(_res));

    } else {

    diag_log ("HIVE: connection problem... HiveExt response:"+str(_hiveResponse));

    };

    _hiveResponse = ["",0];

    }

    else {

    diag_log ("HIVE: found "+str(_hiveResponse select 1)+" objects" );

    _i = 99; // break

    };

    };

    _BuildingQueue = [];

    _objectQueue = [];

    if ((_hiveResponse select 0) == "ObjectStreamStart") then {

    // save superkey

    profileNamespace setVariable ["SUPERKEY",(_hiveResponse select 2)];

    _hiveLoaded = true;

    diag_log ("HIVE: Commence Object Streaming...");

    _key = format["CHILD:302:%1:", dayZ_instance];

    _objectCount = _hiveResponse select 1;

    _bQty = 0;

    _vQty = 0;

    for "_i" from 1 to _objectCount do {

    _hiveResponse = _key call server_hiveReadWriteLarge;

    //diag_log (format["HIVE dbg %1 %2", typeName _hiveResponse, _hiveResponse]);

    if ((_hiveResponse select 2) isKindOf "ModularItems") then {

    _BuildingQueue set [_bQty,_hiveResponse];

    _bQty = _bQty + 1;

    } else {

    _objectQueue set [_vQty,_hiveResponse];

    _vQty = _vQty + 1;

    };

    };

    diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");

    };

    // # NOW SPAWN OBJECTS #

    _totalvehicles = 0;

    {

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

    //switch spawned objects

    switch(_type) do {

    case "Uroven1DrevenaBudka" : { owner_B1 set [count owner_B1, _ownerID]; };

    case "Uroven2KladaDomek" : { owner_B2 set [count owner_B2, _ownerID]; };

    case "Uroven3DrevenyDomek" : { owner_B3 set [count owner_B3, _ownerID]; };

    case "Uroven1VelkaBudka" : { owner_H1 set [count owner_H1, _ownerID]; };

    case "Uroven2MalyDomek" : { owner_H2 set [count owner_H2, _ownerID]; };

    case "Uroven3VelkyDomek" : { owner_H3 set [count owner_H3, _ownerID]; };

    case "malaGaraz" : { owner_SG set [count owner_SG, _ownerID]; };

    };

    //publish publicVariables

    publicVariable "owner_B1";

    publicVariable "owner_B2";

    publicVariable "owner_B3";

    publicVariable "owner_H1";

    publicVariable "owner_H2";

    publicVariable "owner_H3";

    publicVariable "owner_SG";

    // diag_log (format["HOUSE SERVER: Owners Are: B1 %1 B2 %2 B3 %3 H1 %4 H2 %5 H3 %6 SG %7", owner_B1, owner_B2, owner_B3, owner_H1, owner_H2, owner_H3, owner_SG]);

    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

    };

    };

    };

    // diag_log format["Server_monitor: [ObjectID = %1] [ClassID = %2] [_ownerPUID = %3]", _idKey, _type, _ownerPUID];

    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;

    //-----------------Vehicle Changes/Upgrades--------------------//

    //## LAND VEHICLES

    //KA52 Remove Rockets

    if (_object isKindOf "Ka52Black") then {

    _object removeWeapon "80mmLauncher";

    _object removeWeapon "2A42";

    _object removeWeapon "VikhrLauncher";

    _object removeMagazine "40Rnd_80mm";

    _object removeMagazine "40Rnd_S8T";

    _object removeMagazine "40Rnd_80mm";

    _object removeMagazine "40Rnd_S8T";

    _object removeMagazine "12Rnd_Vikhr_KA50";

    };

    //-----------------------------------------------------------//

    _object setdir _dir;

    if(_vecExists)then{

    _object setVectorDirAndUp _vector;

    };

    _object setposATL _pos;

    _object setDamage _damage;

    if ((typeOf _object) in dayz_allowedObjects) then {

    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;

    //---------------------AN2 UPGRADE--START----------------------------------------

    if (_object isKindOf "AN2_DZ") then {

    _object addWeapon "M240_veh";

    _object addMagazine "100Rnd_762x51_M240";

    _object addMagazine "100Rnd_762x51_M240";

    _object addMagazine "100Rnd_762x51_M240";

    _object addMagazine "100Rnd_762x51_M240";

    _object addMagazine "100Rnd_762x51_M240";

    _object addMagazine "100Rnd_762x51_M240";

    };

    //---------------------AN2 END----------------------------------------------------

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

    _object setVariable ["BTC_Cannot_Lift",true,true];

    };

    _totalvehicles = _totalvehicles + 1;

    // total each vehicle

    serverVehicleCounter set [count serverVehicleCounter,_type];

    };

    };

    //Monitor the object

    PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];

    };

    } count (_BuildingQueue + _objectQueue);

    // # END SPAWN OBJECTS #

    // preload server traders menu data into cache

    if !(DZE_ConfigTrader) then {

    {

    // get tids

    _traderData = call compile format["menu_%1;",_x];

    if(!isNil "_traderData") then {

    {

    _traderid = _x select 1;

    _retrader = [];

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

    _data = "HiveEXT" callExtension _key;

    //diag_log "HIVE: Request sent";

    //Process result

    _result = call compile format ["%1",_data];

    _status = _result select 0;

    if (_status == "ObjectStreamStart") then {

    _val = _result select 1;

    //Stream Objects

    //diag_log ("HIVE: Commence Menu Streaming...");

    call compile format["ServerTcache_%1 = [];",_traderid];

    for "_i" from 1 to _val do {

    _data = "HiveEXT" callExtension _key;

    _result = call compile format ["%1",_data];

    call compile format["ServerTcache_%1 set [count ServerTcache_%1,%2]",_traderid,_result];

    _retrader set [count _retrader,_result];

    };

    //diag_log ("HIVE: Streamed " + str(_val) + " objects");

    };

    } forEach (_traderData select 0);

    };

    } forEach serverTraders;

    };

    if (_hiveLoaded) then {

    // spawn_vehicles

    _vehLimit = MaxVehicleLimit - _totalvehicles;

    if(_vehLimit > 0) then {

    diag_log ("HIVE: Spawning # of Vehicles: " + str(_vehLimit));

    for "_x" from 1 to _vehLimit do {

    [] spawn spawn_vehicles;

    };

    } else {

    diag_log "HIVE: Vehicle Spawn limit reached!";

    };

    };

    // spawn_roadblocks

    diag_log ("HIVE: Spawning # of Debris: " + str(MaxDynamicDebris));

    for "_x" from 1 to MaxDynamicDebris do {

    [] spawn spawn_roadblocks;

    };

    // spawn_ammosupply at server start 1% of roadblocks

    diag_log ("HIVE: Spawning # of Ammo Boxes: " + str(MaxAmmoBoxes));

    for "_x" from 1 to MaxAmmoBoxes do {

    [] spawn spawn_ammosupply;

    };

    // call spawning mining veins

    diag_log ("HIVE: Spawning # of Veins: " + str(MaxMineVeins));

    for "_x" from 1 to MaxMineVeins do {

    [] spawn spawn_mineveins;

    };

    if(isnil "dayz_MapArea") then {

    dayz_MapArea = 10000;

    };

    if(isnil "HeliCrashArea") then {

    HeliCrashArea = dayz_MapArea / 2;

    };

    if(isnil "OldHeliCrash") then {

    OldHeliCrash = false;

    };

    //death squad

    [] ExecVM "\z\addons\dayz_server\helicopters\helicopters.sqf";

    //Wicked AI

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

    //DZMS Mission System

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

    allowConnection = true;

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

    };

    allowConnection = true;

    sm_done = true;

    publicVariable "sm_done";

    };

     

     

    Rather than post my entire description.ext, I have added #include "custom\snap_pro\snappoints.hpp" to the end of the file.

     

    Other than that, I did install Snap Pro 1.4.1 and Precise Base Build according to their instructions.  Near as I can tell, the only problem we're seeing is that upgraded objects immediately snap back to the original position as soon as they are upgraded.

     

    Can I see your self action script?

     

    striker

  11. Striker, I have all those changes in my player_upgrade.sqf.   Mine rotates back to the original position as soon as I do the upgrade.  It doesn't need a server restart to put them back to original.  And it's only on upgraded items.  Items that aren't upgraded don't snap back either immediately or after a restart.

     

    I've gone through all the instructions several times and cannot find anything I missed.  I have the basic installation - no AdminBuild or Plot 4 Life.

     

    Bob

     

    Can I see the mission files?

     

    striker

  12. All that is in the player_upgrade.sqf as i've not touched any of the files just upoaded them to mission folder, changed the paths in my own compiles.sqf

     

    I think it could be an issue with fn_selfActions.sqf as when i tried installing Deployables the repack option would not appear after adding it in, this has been taken out for now

     

    Here is my mission folder please take a look

     

    http://www.filedropper.com/dayzepoch11chernarus

     

    Many Thanks

     

    Your files look fine from what I can see. Ill do more extensive testing if I have time when I get home.

     

    I'm not sure what the issue could be...  :unsure:

     

    striker

  13. I am also having the issue with upgrading and it flipping back to default angle

     

    I'm using the V3 none plot for life files

     

    Any other possible fix for the updrade flipping issue?

     

    Only three things change in player_upgrade.sqf, they are as follows

     

    1.

    Where it says

    // Get direction
    _dir = getDir _obj;
    

    Add under it

    // Get Vector
    _vector = [(vectorDir _obj),(vectorUp _obj)];

    2.

    Where it says

    // Set direction
    _object setDir _dir;
    

    Add under it

    // Set vector
    _object setVectorDirAndUp _vector;

    3.

    Change

    PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location],_classname,_obj,player];
    

    to

    PVDZE_obj_Swap = [_objectCharacterID,_object,[_dir,_location, _vector],_classname,_obj,player];
    

    That should fix any problem you are having. Make sure to use the player_upgrade.sqf that you have specified.  :)

     

    striker

×
×
  • Create New...