Jump to content

Affraid

Member
  • Posts

    129
  • Joined

  • Last visited

Posts posted by Affraid

  1. i have it like this is my server_function.sqf:

    //qdoba
    	[] execVM "\z\addons\dayz_server\addons\qdobacrates.sqf";
    	call compile preProcessFileLineNumbers "z\addons\dayz_server\addons\qdoba.sqf";
    

    and i have tried:

    [] execVM "\z\addons\dayz_server\addons\qdobacrates.sqf";
    [] execVM "\z\addons\dayz_server\addons\qdoba.sqf";
    

    but still all i have is:

    KJM5iwY.jpg

     

     

    But still I cant get the building here

     

    yes add

     

    if (isServer) then {

     

    in qdoba.sqf after //affraid.net 

     

    Don't know how that got deleted 

     

  2. This looks very interesting. Nice work indeed and thanks for sharing. 

     

    I would like to do this for panthera. I'm sure it would just be a matter of getting different cords via the map editor. 

     

    Has anyone tested this for panthera yet? where would be a good location?

     

    Thanks again. 

    I have A Panthera map. What I did was made the whole Island A AI Island and added a bunch of crates through out. 

  3. +++++UPDATED 7-24-14+++++

     

    ++Fix'd Entrance to no one can barrel through front entrance with vehicle.

    ++End Maze updated

     

    Here is another city I build for my server. Players really like this one. Included in Zip is the Cords for the AI / weapon crates  using WAI script. And sqf file to custom crates added to city. 

     

    There is a maze at end point where there is a nice Lottery Crate . Not easy to get through maze , so payoff is nice.

     

    QDOBA AI CITY 

     

     

    Picture 1 http://flic.kr/p/kNmqxH

    pic 2 http://flic.kr/p/kNmrh8

    pic3 http://flic.kr/p/kNnNYU

    pic4 http://flic.kr/p/kNnPb7

     

    Download Link https://www.dropbox.com/s/3uk7132x94i532g/Qdoba%20Ai%20city.rar

     

     

    Have Fun 

  4. ok you could try something like this

    SELECT * FROM
    dayz_epoch.object_data OD
    WHERE 1 = 1
    AND OD.inventory IS NOT NULL
    AND OD.inventory NOT LIKE '[]'
    AND OD.classname NOT LIKE '%storage%'
    

    The above code should return only vehicles.  You will want to run this and double check to see what returns.  If it returns non-vehicles you can tweak the query till it doesn't.

     

    Personally, I clean up vehicles based on their timestamp.  At 5 days I unlock vehicles, at 15 days, I delete them.

    ok I will give it a try . TY 

  5. I was using this Web based PHP script. 

     

     

    I'm looking for a Database Event to run weekly or monthly. Having a problem with too many vehicles spawning for no reason. I think this might help clean up DB for now. What i've been reading others are having same problem with vehicles flooding server. 

  6. I'm going through same problem. Havn't found a solution yet either. And if I run delete all vehicles with no inventory. It also deletes base items , like cinder block walls /doors and even some wood items. Does anyone know of a DB event that would only do vehicles and not base building items?

     

     I'm wondering if it's an addon , that we all might have in common on our servers.

  7. I followed the and did the changes I posted.

    I wanted to upload my files, but somehow I can't do it here :huh:

     

    In the post you quite mixed codes up.

     

    server_updateObject.sqf

    /*
    [_object,_type] spawn server_updateObject;
    */
    /* Additional */
    /***********************************/ 	
    /* Vehicle Key Changer v1.3        */
    /* Written by OtterNas3            */
    /* January, 11, 2014               */
    /* Last update: 02/20/2014         */
    /***********************************/
    
    
    private ["_object","_type","_objectID","_uid","_lastUpdate","_needUpdate","_object_position","_object_inventory","_object_damage","_isNotOk","_parachuteWest","_firstTime","_object_killed","_object_repair","_isbuildable","_object_vehicleKey","_activatingPlayer","_vehicleClassname","_toKey","_toKeyName","_vehicle_ID","_vehicle_UID"];
    
    _object = 	_this select 0;
    
    if(isNull(_object)) exitWith {
    	diag_log format["Skipping Null Object: %1", _object];
    };
    
    _type = 	_this select 1;
    _parachuteWest = ((typeOf _object == "ParachuteWest") or (typeOf _object == "ParachuteC"));
    _isbuildable = (typeOf _object) in dayz_allowedObjects;
    _isNotOk = false;
    _firstTime = false;
    
    _objectID =	_object getVariable ["ObjectID","0"];
    _uid = 		_object getVariable ["ObjectUID","0"];
    
    if ((typeName _objectID != "string") || (typeName _uid != "string")) then
    { 
        diag_log(format["Non-string Object: ID %1 UID %2", _objectID, _uid]);
        //force fail
        _objectID = "0";
        _uid = "0";
    };
    
    if (!_parachuteWest and !(locked _object)) then {
    	if (_objectID == "0" && _uid == "0") then
    	{
    		_object_position = getPosATL _object;
        	_isNotOk = true;
    	};
    };
    
    // do not update if buildable and not ok
    if (_isNotOk and _isbuildable) exitWith {  };
    
    // delete if still not ok
    if (_isNotOk) exitWith { deleteVehicle _object; diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",typeOf _object,_object_position select 0,_object_position select 1, _object_position select 2]); };
    
    
    _lastUpdate = _object getVariable ["lastUpdate",time];
    _needUpdate = _object in needUpdate_objects;
    
    // TODO ----------------------
    _object_position = {
    	private["_position","_worldspace","_fuel","_key"];
    		_position = getPosATL _object;
    		_worldspace = [
    			round(direction _object),
    			_position
    		];
    		_fuel = 0;
    		if (_object isKindOf "AllVehicles") then {
    			_fuel = fuel _object;
    		};
    		_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
    		//diag_log ("HIVE: WRITE: "+ str(_key));
    		_key call server_hiveWrite;
    };
    
    _object_inventory = {
    	private["_inventory","_previous","_key"];
    		_inventory = [
    			getWeaponCargo _object,
    			getMagazineCargo _object,
    			getBackpackCargo _object
    		];
    		_previous = str(_object getVariable["lastInventory",[]]);
    		if (str(_inventory) != _previous) then {
    			_object setVariable["lastInventory",_inventory];
    			if (_objectID == "0") then {
    				_key = format["CHILD:309:%1:%2:",_uid,_inventory];
    			} else {
    				_key = format["CHILD:303:%1:%2:",_objectID,_inventory];
    			};
    			//diag_log ("HIVE: WRITE: "+ str(_key));
    			_key call server_hiveWrite;
    		};
    };
    
    _object_damage = {
    	private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    		_hitpoints = _object call vehicle_getHitpoints;
    		_damage = damage _object;
    		_array = [];
    		{
    			_hit = [_object,_x] call object_getHit;
    			_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
    			if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
    			_object setHit ["_selection", _hit]
    		} forEach _hitpoints;
    	
    		_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
    		//diag_log ("HIVE: WRITE: "+ str(_key));
    		_key call server_hiveWrite;
    	_object setVariable ["needUpdate",false,true];
    	};
    
    _object_killed = {
    	private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    	_hitpoints = _object call vehicle_getHitpoints;
    	//_damage = damage _object;
    	_damage = 1;
    	_array = [];
    	{
    		_hit = [_object,_x] call object_getHit;
    		_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
    		if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
    		_hit = 1;
    		_object setHit ["_selection", _hit]
    	} forEach _hitpoints;
    	
    	if (_objectID == "0") then {
    		_key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage];
    	} else {
    		_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
    	};
    	//diag_log ("HIVE: WRITE: "+ str(_key));
    	_key call server_hiveWrite;
    	_object setVariable ["needUpdate",false,true];
    };
    
    _object_repair = {
    	private["_hitpoints","_array","_hit","_selection","_key","_damage"];
    	_hitpoints = _object call vehicle_getHitpoints;
    	_damage = damage _object;
    	_array = [];
    	{
    		_hit = [_object,_x] call object_getHit;
    		_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
    		if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
    		_object setHit ["_selection", _hit]
    	} forEach _hitpoints;
    	
    	_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
    	//diag_log ("HIVE: WRITE: "+ str(_key));
    	_key call server_hiveWrite;
    	_object setVariable ["needUpdate",false,true];
    };
    
    _object_vehicleKey = {
    	private["_hitpoints","_array","_hit","_selection","_key","_damage","_fuel","_inventory","_class","_position","_worldspace","_newKey","_newKeyName","_player","_oldVehicleID","_vehicleID","_vehicleUID","_result","_outcome","_retry","_gotcha"];
    	
    	/* Setting up variables */
    	_player = _this select 0;
    	_class = _this select 1;
    	_newKey = _this select 2;
    	_newKeyName = _this select 3;
    	_oldVehicleID = _this select 4;
    	_vehicleUID = _this select 5;
    
    	/* Get Damage of the Vehicle */
    	_hitpoints = _object call vehicle_getHitpoints;
    	_damage = damage _object;
    	_array = [];
    	{
    		_hit = [_object,_x] call object_getHit;
    		_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
    		if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
    		_object setHit ["_selection", _hit]
    	} forEach _hitpoints;
    	
    	/* Get the Fuel of the Vehicle */
    	_fuel = 0;
    	if (_object isKindOf "AllVehicles") then {
    		_fuel = fuel _object;
    	};
    	
    	/* Get the Inventory of the Vehicle */
    	_inventory = [
    		getWeaponCargo _object,
    		getMagazineCargo _object,
    		getBackpackCargo _object
    	];
    	
    	/* Get the position of the Vehicle */
    	_position = getPosATL _object;
    	_worldspace = [
    		round(direction _object),
    		_position
    	];
    
    	/* Delete the current Database entry */
    	[_oldVehicleID,_vehicleUID,_player] call server_deleteObj;
    	sleep 1;
    	
    	/* Write the new Database entry and LOG the action*/
    	_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _newKey, _worldspace, _inventory, _array, _fuel,_vehicleUID];
    	_key call server_hiveWrite;
    	diag_log ("HIVE: WRITE: VEHICLE KEY CHANGER: "+ str(_key)); 
    	diag_log format["HIVE: WRITE: VEHICLE KEY CHANGER: Vehicle:%1 NewKey:%2 BY %3(%4)", _object, _newKeyName, (name _player), (getPlayerUID _player)];
    
    	/* Get the ObjectID of the entry in the Database */
    	_retry = 0;
    	_gotcha = false;
    	while {!_gotcha && _retry < 10} do {
    		sleep 1;
    		
    		/* Send the request */
    		_key = format["CHILD:388:%1:",_vehicleUID];
    		diag_log ("HIVE: READ: VEHICLE KEY CHANGER: "+ str(_key));
    		_result = _key call server_hiveReadWrite;
    		_outcome = _result select 0;
    		
    		/* We got a answer */
    		if (_outcome == "PASS") then {
    			_vehicleID = _result select 1;
    			
    			/* Compare with old ObjectID to check if it not was deleted yet */
    			if (_oldVehicleID == _vehicleID) then {
    				/* Not good lets give it another try */
    				_gotcha = false;
    				_retry = _retry + 1;
    			} else {
    				/* GOTCHA! */
    				diag_log("CUSTOM: VEHICLE KEY CHANGER: Selected " + str(_vehicleID));
    				_gotcha = true;
    				_retry = 11;
    			};
    		} else {
    			/* Something went wrong on the request give it another try */
    			diag_log("CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: " + str(_vehicleUID));
    			_gotcha = false;
    			_retry = _retry + 1;
    		};
    	};
    
    	/* Lock the Vehicle */
    	_object setVehicleLock "locked";
    	
    	/* Save the ObjectID to the vehicles variable and make it public */
    	_object setVariable ["ObjectID", _vehicleID, true];
    
    	/* Save the ObjectUID to the vehicles variable and make it public */
    	_object setVariable ["ObjectUID", _vehicleUID, true];
    
    	/* Set the lastUpdate time to current */
    	_object setVariable ["lastUpdate",time];
    	
    	/* Set the CharacterID to the new Key so we can access it! */
    	_object setVariable ["CharacterID", _newKey, true];
    	
    	/* Some other variables you might need for disallow lift/tow/cargo locked Vehicles and such */
    	/* Uncomment if you use this */
    	
    	/* R3F Arty and LOG block lift/tow/cargo locked vehicles*/
    	_object setVariable ["R3F_LOG_disabled",true,true];
    	
    	/* =BTC= Logistic block lift locked vehicles*/
    	_object setVariable ["BTC_Cannot_Lift",true,true];
    	
    	_object setVariable ["sidegundeployed",0,true];
    	_object setVariable ["reargundeployed",0,true];
    
    	_object call fnc_veh_ResetEH;
    };
    // TODO ----------------------
    
    _object setVariable ["lastUpdate",time,true];
    switch (_type) do {
    	case "all": {
    		call _object_position;
    		call _object_inventory;
    		call _object_damage;
    		};
    	case "position": {
    		if (!(_object in needUpdate_objects)) then {
    			//diag_log format["DEBUG Position: Added to NeedUpdate=%1",_object];
    			needUpdate_objects set [count needUpdate_objects, _object];
    		};
    	};
    	case "gear": {
    		call _object_inventory;
    			};
    	case "damage": {
    		if ( (time - _lastUpdate) > 5) then {
    			call _object_damage;
    		} else {
    			if (!(_object in needUpdate_objects)) then {
    				//diag_log format["DEBUG Damage: Added to NeedUpdate=%1",_object];
    				needUpdate_objects set [count needUpdate_objects, _object];
    			};
    		};
    	};
    	case "killed": {
    		call _object_killed;
    	};
    	case "repair": {
    		call _object_damage;
    	};
    	case "vehiclekey": {
    		_activatingPlayer = _this select 2;
    		_vehicleClassname = _this select 3;
    		_toKey = _this select 4;
    		_toKeyName = _this select 5;
    		_vehicle_ID = _this select 6;
    		_vehicle_UID = _this select 7;
    		[_activatingPlayer, _vehicleClassname, _toKey, _toKeyName, _vehicle_ID, _vehicle_UID] call _object_vehicleKey;
    	};
    };
    
    

    VehicleKeyChanger.sqf

    /***********************************/ 	
    /* Vehicle Key Changer v1.3        */
    /* Written by OtterNas3            */
    /* January, 11, 2014               */
    /* Last update: 02/20/2014         */
    /***********************************/
    
    
    /* Setup the private variables */
    private ["_magazinesPlayer","_max","_j","_actionArray","_targetVehicle","_targetVehicleID","_targetVehicleUID","_playerKeys","_playerKeysDisplayName","_targetVehicleKeyName","_itemKeyName","_targetVehicleClassname","_targetVehiclePos","_targetVehicleDir","_Price","_claimingPrice"];
    
    /* Remove the Action Menu entry */
    player removeAction s_player_copyToKey;
    s_player_copyToKey = 0;
    
    /* Get the array and setup the variables */
    _actionArray = _this select 3;
    _targetVehicle = _actionArray select 0;
    _targetVehicleID = _targetVehicle getVariable ["ObjectID","0"];
    _targetVehicleUID = _targetVehicle getVariable ["ObjectUID","0"];
    
    /* Check if the Vehicle is in the Database, if false exit */
    if (_targetVehicleID == "0" && _targetVehicleUID == "0") exitWith {s_player_copyToKey = -1;};
    
    /* Setup more variables */
    _playerKeys = _actionArray select 1;
    _playerKeysDisplayName = _actionArray select 3;
    _targetVehicleKeyName = _actionArray select 4;
    _itemKeyName = _actionArray select 5;
    _Price = _actionArray select 6;
    _claimingPrice = _actionArray select 7;
    _targetVehicleClassname = typeOf _targetVehicle;
    _targetVehiclePos = getPosATL _targetVehicle;
    _targetVehicleDir = getDir _targetVehicle;
    
    /* Setup the Key Names list to select from */
    keyNameList = [];
    for "_i" from 0 to (count _playerKeysDisplayName) -1 do {
    	keyNameList set [(count keyNameList), _playerKeysDisplayName select _i];
    };
    
    /* Setup the Key Numbers list to select from */
    keyNumberList = [];
    for "_i" from 0 to (count _playerKeys) -1 do {
    	keyNumberList set [(count keyNumberList), _playerKeys select _i];
    };
    
    /* Resetting menu variables*/
    keyNameSelect = "";
    exitscript = true;
    snext = false;
    
    /* Creating the menu */
    copyMenu =
    {
    	private ["_keyMenu","_keyArray"];
    	_keyMenu = [["",true], ["Change Vehicle to Key:", [-1], "", -5, [["expression", ""]], "1", "0"]];
    	for "_i" from (_this select 0) to (_this select 1) do
    	{
    		_keyArray = [format['%1', keyNameList select (_i)], [_i - (_this select 0) + 2], "", -5, [["expression", format ["keyNameSelect = keyNameList select %1; keyNumberSelect = keyNumberList select %1", _i]]], "1", "1"];
    		_keyMenu set [_i + 2, _keyArray];
    	};
    	_keyMenu set [(_this select 1) + 2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];
    	if (count keyNameList > (_this select 1)) then
    	{
    		_keyMenu set [(_this select 1) + 3, ["Next", [12], "", -5, [["expression", "snext = true;"]], "1", "1"]];
    	} else {
    		_keyMenu set [(_this select 1) + 3, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];
    	};
    	_keyMenu set [(_this select 1) + 4, ["Exit", [13], "", -5, [["expression", "keyNameSelect = 'exitscript';"]], "1", "1"]];
    	showCommandingMenu "#USER:_keyMenu";
    };
    
    /* Wait for the player to select a Key from the list */
    _j = 0;
    _max = 10;
    if (_max > 9) then {_max = 10;};
    while {keyNameSelect == ""} do {
    	[_j, (_j + _max) min (count keyNameList)] call copyMenu;
    	_j = _j + _max;
    	waitUntil {keyNameSelect != "" || snext};
    	snext = false;
    };
    
    /* Player selected a Key, lets make the Vehicle update call */
    if (keyNameSelect != "exitscript") then {
    	
    	/* Check again for the needed TinBar or claiming price and remove em from the players inventory */
    	_magazinesPlayer = magazines player;
    	if (_Price != "0") then {
    		if (_Price in _magazinesPlayer) then {
    			[player, _Price, 1] call BIS_fnc_invRemove;
    			systemChat (format["Keychange costs 1 %1, thanks for your Payment!", _Price]);
    		} else {
    			systemChat (format["Keychange costs 1 %1, you had it and tried to trick the system - Keychange for this Vehicle disabled!", Price]);
    			_targetVehicle setVariable ["VKC_disabled", 1, true];
    			s_player_copyToKey = -1;
    			breakOut "exit";
    		};
    	};
    	if (_claimingPrice != "0") then {
    		if (_claimingPrice in _magazinesPlayer) then {
    			[player, _claimingPrice, 1] call BIS_fnc_invRemove;
    			systemChat (format["Claiming Vehicle costs 1 %1, thanks for your Payment!", _claimingPrice]);
    		} else {
    			systemChat (format["Claiming Vehicle costs 1 %1, you had it and tried to trick the system - Claiming for this Vehicle disabled!", Price]);
    			_targetVehicle setVariable ["VKC_claiming_disabled", 1, true];
    			s_player_copyToKey = -1;
    			breakOut "exit";
    		};
    	};
    	
    	/* We got the Money lets do our Job */
    	/* Lock the vehicle */
    	_targetVehicle setVehicleLock "LOCKED";
    	
    	/* The super duper OneForAllAnimation... */
    	player playActionNow "Medic";
    	
    	/* Remove the Key from the Toolbelt of the player and put it in the Backpack - No Backpack and the Key gets lost */
    	if (_itemKeyName != "0") then {
    		if (!isNull (unitBackpack player)) then {
    			[player, _itemKeyName, 1] call BIS_fnc_invRemove;
    			(unitBackpack (vehicle player)) addWeaponCargoGlobal [_itemKeyName, 1];
    			systemChat (format["%1 has been moved to your Backpack", _targetVehicleKeyName]);
    		};
    	};
    
    	/* Giving unique UID for claimed vehicles */
    	if (_targetVehicleUID=="0") then {
    		_targetVehicleUID = _targetVehicle call dayz_objectUID_vkc;
    		_targetVehicle setVariable ["ObjectUID",_targetVehicleUID,true];
    	};
    
    	/* This calls the custom update function which we put it in server_updateObject.sqf */
    	PVDZE_veh_Update = [_targetVehicle, "vehiclekey", player, _targetVehicleClassname, keyNumberSelect, keyNameSelect, _targetVehicleID, _targetVehicleUID]; 
    	publicVariableServer "PVDZE_veh_Update"; 
    
    	/* Inform the player about the success and tell him to check the Key */
    	systemChat (format["Changed Vehicle Key to %1", keyNameSelect]);
    	if (_targetVehicleKeyName != "0") then {
    		systemChat (format["Please check Vehicle function with %1 before you throw away %2!", keyNameSelect, _targetVehicleKeyName]);
    	};
    };
    
    /* Reset the action menu variable for a new run */
    s_player_copyToKey = -1;
    
    /**************************************/
    /* That's it, hope you enjoy this Mod */
    /*                                    */
    /* Yours sincerly,                    */
    /* Otter                              */
    /**************************************/
    

    VehicleKeyChanger_init.sqf

    /***********************************/ 	
    /* Vehicle Key Changer v1.3        */
    /* Written by OtterNas3            */
    /* January, 11, 2014               */
    /* Last update: 02/20/2014         */
    /***********************************/
    
    
    private ["_itemsPlayer","_magazinesPlayer","_temp_Keys","_temp_keysDisplayName","_temp_keysDisplayNameParse","_key_colors","_ownerKeyId","_carKey","_hasKey","_cTarget","_keyName","_carKeyName","_targetVehicleKey","_temp_keysParse"];
    
    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    // Edit these settings to fit your needs/likes //
    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    /// Claim Vehicles that does not yet need Key ///
    ///////// 0 = Not allowed | 1 = Allowed /////////
    vkc_claiming = 1;
    /////////////////////////////////////////////////
    //////// Claim Vehicles costs this Item /////////
    /// Any Item can be used here, some examples: ///
    //// ItemTinBar, ItemSilverBar, ItemGoldBar, ////
    ////// ItemSilverBar10oz, ItemGoldBar10oz, //////
    ///// ItemBriefcase20oz, ItemBriefcase100oz /////
    //////// set to "0" to disable the costs ////////
    vkc_claimingPrice = "ItemGoldBar10oz";
    /////////////////////////////////////////////////
    ////////// Change Key costs this Item// /////////
    ////////////// see above examples ///////////////
    //////// set to "0" to disable the costs ////////
    vkc_Price = "ItemGoldBar";
    /////////////////////////////////////////////////
    /////// Need KeyKit to use this function ////////
    ////////// 0 = Not needed | 1 = Needed //////////
    vkc_needKeykit = 1;
    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    /////////////// DONT EDIT BELOW ! ///////////////
    /////////////////////////////////////////////////
    
    /* Reset variables function */
    ON_fnc_vkc_reset = {
    	_cTarget = objNull;
    	_itemsPlayer = [];
    	_temp_keys = [];
    	_carKey = objNull;
    	_hasKey = false;
    	_temp_keysDisplayName = [];
    	_temp_keysDisplayNameParse = [];
    	_temp_keysParse = [];
    	_targetVehicleKey = objNull;
    	_carKeyName = "";
    	player removeAction s_player_copyToKey;
    	s_player_copyToKey = -1;
    };
    
    dayz_objectUID_vkc = {
    	private["_position","_dir","_key","_object"];
    	_object = _this;
    	_position = getPosATL _object;
    	_dir = direction _object;
    	_key = [_dir,_position] call dayz_objectUID2_vkc;
        _key
    };
    
    dayz_objectUID2_vkc = {
    	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));
    	} forEach _position;
    	_key = _key + str(round(_dir));
    	_key
    };
    
    /* Wait for player full ingame so we can access the action-menu */
    waitUntil {!isNil "dayz_animalCheck"};
    
    s_player_copyToKey=-1;
    lastKeyChangeCursorTarget = [objNull,objNull,objNull,objNull,objNull];
    
    /* Start the loop check */
    while{true} do {
    	sleep 3;
    	if (!isNull cursorTarget && speed player <= 1 && (vehicle player) == player && !isEngineOn cursorTarget && (cursorTarget isKindOf "Motorcycle" || cursorTarget isKindOf "Car" || cursorTarget isKindOf "Air" || cursorTarget isKindOf "Ship") && (cursorTarget distance player) <= 10 && cursorTarget getVariable ["VKC_disabled", 0] == 0 && cursorTarget getVariable ["VKC_claiming_disabled",0] == 0) then {
    		_cTarget = cursorTarget;
    		_itemsPlayer = items player;
    		_magazinesPlayer = magazines player;
    		if ((lastKeyChangeCursorTarget select 0) != _cTarget) then {
    			if (s_player_copyToKey >= 0) then {
    				player removeAction s_player_copyToKey;
    				s_player_copyToKey = -1;
    			};
    		};
    		lastKeyChangeCursorTarget set [0,_cTarget];
    		_carKey = _cTarget getVariable ["CharacterID","0"];
    		if (("ItemKeyKit" in _itemsPlayer || vkc_needKeykit == 0) && ((_carKey == "0" && vkc_claiming == 1 && (vkc_claimingPrice == "0" || vkc_claimingPrice in _magazinesPlayer)) || _carKey != "0") && (vkc_Price == "0" || vkc_Price in _magazinesPlayer)) then {
    			if (_carKey == "0") then {
    				_temp_keys = [];
    				_temp_keysDisplayName = [];
    				_temp_keysDisplayNameParse = [];
    				_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
    				{
    					if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
    						_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
    						_keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
    						_temp_keysDisplayName set [count _temp_keysDisplayName,_keyName];
    						_temp_keys set [count _temp_keys,str(_ownerKeyId)];
    					};
    				} forEach _itemsPlayer;
    				if ((count _temp_keys) > 0) then {
    					if (s_player_copyToKey < 0) then {
    						lastKeyChangeCursorTarget set [0,_cTarget];
    						s_player_copyToKey = player addAction [("<t color=""#c03636"">" + ("Claim Vehicle") + "</t>"),"custom\VehicleKeyChanger\VehicleKeyChanger.sqf",[_cTarget, _temp_keys, "0", _temp_keysDisplayName, "0", "0", vkc_Price, vkc_claimingPrice],-1,false,false,"",""];
    					};
    				} else {
    					[] call ON_fnc_vkc_reset;
    				};
    			} else {
    				_temp_keys = [];
    				_temp_keysDisplayName = [];
    				_temp_keysDisplayNameParse = [];
    				_temp_keysParse = [];
    				_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
    				{
    					if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
    						_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
    						_keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
    						_temp_keysDisplayName set [count _temp_keysDisplayName,_keyName];
    						_temp_keysDisplayNameParse set [_ownerKeyId,_keyName];
    						_temp_keys set [count _temp_keys,str(_ownerKeyId)];
    						_temp_keysParse set [_ownerKeyId, _x];
    					};
    				} forEach _itemsPlayer;
    				_hasKey = _carKey in _temp_keys;
    				if (_hasKey && (count _temp_keys) > 1) then {
    					_carKeyName = (_temp_keysDisplayNameParse select (parseNumber _carKey));
    					_targetVehicleKey = (_temp_keysParse select (parseNumber _carKey));
    					_temp_keys = _temp_keys - [_carKey];
    					_temp_keysDisplayName = _temp_keysDisplayName - [_carKeyName];
    					if (s_player_copyToKey < 0) then {
    						lastKeyChangeCursorTarget set [0,_cTarget];
    						s_player_copyToKey = player addAction [("<t color=""#c03636"">" + ("Change Vehicle Key") + "</t>"),"custom\VehicleKeyChanger\VehicleKeyChanger.sqf",[_cTarget, _temp_keys, _carKey, _temp_keysDisplayName, _carKeyName, _targetVehicleKey, vkc_Price, "0"],-1,false,false,"",""];
    					};
    				} else {
    					[] call ON_fnc_vkc_reset;
    				};
    			};
    		} else {
    			[] call ON_fnc_vkc_reset;
    		};
    	} else {
    		lastKeyChangeCursorTarget = [objNull,objNull,objNull,objNull,objNull];
    		[] call ON_fnc_vkc_reset;
    	};
    };
    
    
    

    And you got the files to work? I'll givethem a try . 

     

      Thank You 

  8. @GWANDOYA

     

    Did add the code right? I can't get it to work at all now. No option comes up when I'm at a vehicle. I did not add the claim vehicle change. Since I don't use that option.

     

    Thank you in advance 

     

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


    /* Vehicle Key Changer v1.3 */
    /* Written by OtterNas3 */
    /* January, 11, 2014 */
    /* Last update: 02/20/2014 */
    /***********************************/


    private ["_itemsPlayer","_magazinesPlayer","_temp_Keys","_temp_keysDisplayName","_temp_keysDisplayNameParse","_key_colors","_ownerKeyId","_carKey","_hasKey","_cTarget","_keyName","_carKeyName","_targetVehicleKey","_temp_keysParse"];

    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    // Edit these settings to fit your needs/likes //
    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    /// Claim Vehicles that does not yet need Key ///
    ///////// 0 = Not allowed | 1 = Allowed /////////
    vkc_claiming = 0;
    /////////////////////////////////////////////////
    //////// Claim Vehicles costs this Item /////////
    /// Any Item can be used here, some examples: ///
    //// ItemTinBar, ItemSilverBar, ItemGoldBar, ////
    ////// ItemSilverBar10oz, ItemGoldBar10oz, //////
    ///// ItemBriefcase20oz, ItemBriefcase100oz /////
    //////// set to "0" to disable the costs ////////
    vkc_claimingPrice = "ItemGoldBar10oz";
    /////////////////////////////////////////////////
    ////////// Change Key costs this Item// /////////
    ////////////// see above examples ///////////////
    //////// set to "0" to disable the costs ////////
    vkc_Price = "0";
    /////////////////////////////////////////////////
    /////// Need KeyKit to use this function ////////
    ////////// 0 = Not needed | 1 = Needed //////////
    vkc_needKeykit = 1;
    /////////////////////////////////////////////////
    /////////////////////////////////////////////////
    /////////////// DONT EDIT BELOW ! ///////////////
    /////////////////////////////////////////////////

    /* Reset variables function */
    ON_fnc_vkc_reset = {
    _cTarget = objNull;
    _itemsPlayer = [];
    _temp_keys = [];
    _carKey = objNull;
    _hasKey = false;
    _temp_keysDisplayName = [];
    _temp_keysDisplayNameParse = [];
    _temp_keysParse = [];
    _targetVehicleKey = objNull;
    _carKeyName = "";
    player removeAction s_player_copyToKey;
    s_player_copyToKey = -1;
    };

    /* Wait for player full ingame so we can access the action-menu */
    waitUntil {!isNil "dayz_animalCheck"};
    s_player_copyToKey=-1;
    lastKeyChangeCursorTarget = [objNull,objNull,objNull,objNull,objNull];

    /* Start the loop check */
    while{true} do {
    sleep 3;
    if (!isNull cursorTarget && speed player <= 1 && (vehicle player) == player && !isEngineOn cursorTarget && (cursorTarget isKindOf "Motorcycle" || cursorTarget isKindOf "Car" || cursorTarget isKindOf "Air" || cursorTarget isKindOf "Ship") && (cursorTarget distance player) <= 10 && cursorTarget getVariable ["VKC_disabled", 0] == 0 && cursorTarget getVariable ["VKC_claiming_disabled",0] == 0) then {
    _cTarget = cursorTarget;
    _itemsPlayer = items player;
    _magazinesPlayer = magazines player;
    if ((lastKeyChangeCursorTarget select 0) != _cTarget) then {
    if (s_player_copyToKey >= 0) then {
    player removeAction s_player_copyToKey;
    s_player_copyToKey = -1;
    };
    };
    lastKeyChangeCursorTarget set [0,_cTarget];
    _carKey = _cTarget getVariable ["CharacterID","0"];
    if (("ItemKeyKit" in _itemsPlayer || vkc_needKeykit == 0) && ((_carKey == "0" && vkc_claiming == 1 && (vkc_claimingPrice == "0" || vkc_claimingPrice in _magazinesPlayer)) || _carKey != "0") && (vkc_Price == "0" || vkc_Price in _magazinesPlayer)) then {
    if (_carKey == "0") then {
    _temp_keys = [];
    _temp_keysDisplayName = [];
    _temp_keysDisplayNameParse = [];
    _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
    {
    if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
    _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
    _keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
    _temp_keysDisplayName set [count _temp_keysDisplayName,_keyName];
    _temp_keys set [count _temp_keys,str(_ownerKeyId)];
    };
    } forEach _itemsPlayer;
    if ((count _temp_keys) > 0) then {
    if (s_player_copyToKey < 0) then {
    lastKeyChangeCursorTarget set [0,_cTarget];
    s_player_copyToKey = player addAction [("" + ("Change Vehicle Key") + ""),"custom\VehicleKeyChanger\VehicleKeyChanger.sqf",[_cTarget, _temp_keys, "0", _temp_keysDisplayName, "0", "0", vkc_Price, vkc_claimingPrice],-1,false,false,"",""];
    };
    } else {
    [] call ON_fnc_vkc_reset;
    dayz_objectUID_vkc = {
    private["_position","_dir","_key","_object"];
    _object = _this;
    _position = getPosATL _object;
    _dir = direction _object;
    _key = [_dir,_position] call dayz_objectUID2_vkc;
    _key
    };

    dayz_objectUID2_vkc = {
    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));
    } forEach _position;
    _key = _key + str(round(_dir));
    _key
    };

    };
    if (_carKey != "0") then {
    _temp_keys = [];
    _temp_keysDisplayName = [];
    _temp_keysDisplayNameParse = [];
    _temp_keysParse = [];
    _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
    {
    if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
    _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
    _keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
    _temp_keysDisplayName set [count _temp_keysDisplayName,_keyName];
    _temp_keysDisplayNameParse set [_ownerKeyId,_keyName];
    _temp_keys set [count _temp_keys,str(_ownerKeyId)];
    _temp_keysParse set [_ownerKeyId, _x];
    };
    } forEach _itemsPlayer;
    _hasKey = _carKey in _temp_keys;
    if (_hasKey && (count _temp_keys) > 1) then {
    _carKeyName = (_temp_keysDisplayNameParse select (parseNumber _carKey));
    _targetVehicleKey = (_temp_keysParse select (parseNumber _carKey));
    _temp_keys = _temp_keys - [_carKey];
    _temp_keysDisplayName = _temp_keysDisplayName - [_carKeyName];
    if (s_player_copyToKey < 0) then {
    lastKeyChangeCursorTarget set [0,_cTarget];
    s_player_copyToKey = player addAction [("" + ("Change Vehicle Key") + ""),"custom\VehicleKeyChanger\VehicleKeyChanger.sqf",[_cTarget, _temp_keys, _carKey, _temp_keysDisplayName, _carKeyName, _targetVehicleKey, vkc_Price, "0"],-1,false,false,"",""];
    };
    } else {
    [] call ON_fnc_vkc_reset;
    };
    };
    } else {
    [] call ON_fnc_vkc_reset;
    };
    } else {
    lastKeyChangeCursorTarget = [objNull,objNull,objNull,objNull,objNull];
    [] call ON_fnc_vkc_reset;
    };
    };

  9. Here is another city I have made and is only Exclusive to my server right now, Still tweeking it out and adding more features, When completely done I will post up files.

     

    This is Qdoba AI City .

     

    Ai using WAi . Has static weapons , Custom crates , and an End MAZE with a nice payoff crate .

     

     

    Picture 1 http://flic.kr/p/kNmqxH

    pic 2 http://flic.kr/p/kNmrh8

    pic3 http://flic.kr/p/kNnNYU

    pic4 http://flic.kr/p/kNnPb7

     

     

    Also just finishing up a Bunker Section with Ai's. Video coming soon on that .

×
×
  • Create New...