Jump to content

[RELEASE] Vehicle Key Changer - For making Masterkey - V 1.4 (Updated 06/15/2014)


OtterNas3

Recommended Posts

I'm not at home so can't test, but I'm pretty sure I remember that you can only claim a vehicle that is a hive vehicle. I know you can't make a key for a map spawn using infistar, says vehicle has id of 0 and cannot be made. However, you should be able to claim a hotwired vehicle.

 

Indeed, (on the keyless vehicles)  we don't seem to be able to claim vehicles that have keys either though, meaning vehicles stolen from other players with the hotwire kits.  Any idea where I might be able to look to work at changing this?  Not sure if it's relevant, but the vehicles we're having issues with are tank-ish.  (BTR, BDRM).  Saw an earlier post where someone said you had to add tanks in, which I did...

 

if ((_cursorTarget isKindOf "Motorcycle" || _cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Tank" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf "Ship")) then {

 

But still no dice. Thanks again for any help :)

Link to comment
Share on other sites

@P0k3r_OF_Sm0t

 

Any chance you could have a gander over my server_updateobject.sqf below, as i am still no closer to sorting this, think it needs a keener eye than mine.

 

Thanks

Spear

 

Ok so im not aloud to make attachments yet.

 

Sorry to fill the post up with script.

 

/*

[_object,_type] spawn server_updateObject;

*/

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

};

// Epoch Admin Tools

if (_object getVariable "MalSar" == 1) exitWith {};

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 ["_hit","_selection","_fuel","_gotcha","_retry","_vehicleID","_key","_result","_outcome","_player","_class","_newKey","_newKeyName","_oldVehicleID","_oldVehicleUID","_hitpoints","_damage","_array","_inventory","_vehicleUID","_position","_dir","_worldspace"];

    

    /* Setting up variables */

    _player = _this select 0;

    _class = _this select 1;

    _newKey = _this select 2;

    _newKeyName = _this select 3;

    _oldVehicleID = _this select 4;

    _oldVehicleUID = _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     = getPosASL _object;

    if !(surfaceIsWater _position) then {

        _position =  ASLToATL _position;

    };

    _dir         = getDir _object;

    _worldspace = [_dir,_position];

    /* Delete the current Database entry */

    [_oldVehicleID,_oldVehicleUID,_player] call server_deleteObj;

    sleep 1;

    

    /* Generate a new UID */

    _vehicleUID = _worldspace call dayz_objectUID3;

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

                _object setVariable ["VKC_disabled", 1,true];

                _object setVariable ["VKC_claiming_disabled", 1,true];

                [_object] spawn {

                    private ["_veh"];

                    _veh = _this select 0;

                    sleep 30;

                    _veh setVariable ["VKC_disabled", 0,true];

                    _veh setVariable ["VKC_claiming_disabled", 0,true];

                };

                PVDZE_vkc_Success = true;

                (owner _player) publicVariableClient "PVDZE_vkc_Success";

                /* Lock the Vehicle */

                _object setVehicleLock "locked";

    

                /* Save the ObjectID and ObjectUID to the vehicles variable and make it public */

                _object setVariable ["ObjectID", _vehicleID, true];

                _object setVariable ["ObjectUID", _vehicleUID, true];

    

                /* Set the lastUpdate time to current */

                _object setVariable ["lastUpdate",time,true];

    

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

            };

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

        };

    };

};

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

    };

};

 

Here is my working serever_updateobject.sqf. There are a couple things in mine that are part of other scripts but I'm not 100% sure which ones. Feel free to copy it and try on your's. You can also just use diffmerge to merge your existing server_updateobject to otter's. Raymix made a nice video explaining how to use it here: And for future reference, you can use spoiler tags so you don't have to fill half a page with code. Use this: [spailer]your code here[/spailer] (mispelled spailer on purpose so you can see spoiler code)

/*

[_object,_type] spawn server_updateObject;

*/

/* Additional */

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

/* Vehicle Key Changer v1.4        */

/* Written by OtterNas3            */

/* January, 11, 2014               */

/* Last update: 06/15/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 ["_hit","_selection","_fuel","_gotcha","_retry","_vehicleID","_key","_result","_outcome","_player","_class","_newKey","_newKeyName","_oldVehicleID","_oldVehicleUID","_hitpoints","_damage","_array","_inventory","_vehicleUID","_position","_dir","_worldspace"];

    

    /* Setting up variables */

    _player = _this select 0;

    _class = _this select 1;

    _newKey = _this select 2;

    _newKeyName = _this select 3;

    _oldVehicleID = _this select 4;

    _oldVehicleUID = _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     = getPosASL _object;

    if !(surfaceIsWater _position) then {

        _position =  ASLToATL _position;

    };

    _dir         = getDir _object;

    _worldspace = [_dir,_position];

    /* Delete the current Database entry */

    [_oldVehicleID,_oldVehicleUID,_player] call server_deleteObj;

    sleep 1;

    

    /* Generate a new UID */

    _vehicleUID = _worldspace call dayz_objectUID3;

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

                _object setVariable ["VKC_disabled", 1,true];

                _object setVariable ["VKC_claiming_disabled", 1,true];

                [_object] spawn {

                    private ["_veh"];

                    _veh = _this select 0;

                    sleep 30;

                    _veh setVariable ["VKC_disabled", 0,true];

                    _veh setVariable ["VKC_claiming_disabled", 0,true];

                };

                PVDZE_vkc_Success = true;

                (owner _player) publicVariableClient "PVDZE_vkc_Success";

                /* Lock the Vehicle */

                _object setVehicleLock "locked";

    

                /* Save the ObjectID and ObjectUID to the vehicles variable and make it public */

                _object setVariable ["ObjectID", _vehicleID, true];

                _object setVariable ["ObjectUID", _vehicleUID, true];

    

                /* Set the lastUpdate time to current */

                _object setVariable ["lastUpdate",time,true];

    

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

            };

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

        };

    };

};

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

    };

};

 

@cm_red000:

Not sure on the claiming, I just re-enabled it on my test server and will let you know.

 

EDIT: My bad on a previous post, I was mistaken. It appears that the only vehicles I am able to claim on my server are NOT the HIVE vehicles. Just the normal map spawns. Meaning, if the vehicle has a key assigned to it, it's not claimable... Sorry for confusion.

I can confirm that the server_updateobject.sqf above does work to change vehicle keys on purchased vehicles that you DO have a key for. it also works to claim normal map spawn vehicles including tanks and BTR's after adding | _cursorTarget isKindOf "Tank" | to the keychanger_init.sqf. Does not work to claim anything that is a HIVE vehicle with a key including hotwired vehicles.

If it DOESN'T lock, you can claim it. If it's LOCKABLE, you can't claim it.

Link to comment
Share on other sites

It appears that the only vehicles I am able to claim on my server are NOT the HIVE vehicles. Just the normal map spawns. Meaning, if the vehicle has a key assigned to it, it's not claimable.

Gotcha. In that case - is there anything I can change to make the inverse true? lol. So that people ARE able to claim and make keys for stolen vehicles? All unlocked vehicles lock on server restart, so the issue we're having is that people who are able to steal a car, can no longer access it once the server has restarted without a way to claim or make a key for it. The keyless vehicles don't persist through restarts anyway, so I'm less concerned with whether or not those can be claimed.

Any idea where I might look to try and change that around?

Thanks again for all your help :)

Link to comment
Share on other sites

@hellraver and @P0k3r_OF_Sm0t

 

Unfortunately still had no luck with this :-(, dont want to give up on it as i want to understand why its not working (i dont like being beaten).

 

It just seems to loop every time i try to change the key, i can see it trying to write to the hive when the keychange script is working but then just stops and shows the fail msg.

Double checked all the files and confirmed there correct, checked it agains yours P0k3r_OF_Sm0t and also another friends.

 

Realy lost with this now :-(

 

Thanks for the help tho gents if i cant get it working in the next few days i think i may just have to give up on it.

 

Thanks

Spear

Link to comment
Share on other sites

I installed the 1.4.1 and everything seems to be working ok, but I do see this in the client logs.

 

Error in expression <ON_fnc_vkcReset = {

player removeAction s_player_claimVehicle;

s_player_claimVeh>

  Error position: <s_player_claimVehicle;

s_player_claimVeh>

  Error Undefined variable in expression: s_player_claimvehicle

File mpmissions\__CUR_MP.Chernarus\custom\VehicleKeyChanger\VehicleKeyChanger_init.sqf, line 41

 

I'm having this same problem but I'm running the original version that otter posted. I'm running overpoch 1.0.5.1, with the latest version of arma 2. except my rpt log says line 40 instead of line 41. Anyone able to help with this?

Link to comment
Share on other sites

Solved my issue now, Thanks for the help

 

Was something really simple and stupid that i am embarrassed to admit lol

 

Found the issue when i was making some changes to my DZAI script ant they were not taking effect.

I had a backup PBO saved in the server directory with "(Backup)" in the end of the pbo name and the sever was looking to that every time so any changes i made to the main pbo were not taking effect as the server wasn't looking at the PBO i was editing.

 

Feel like a total numb nuts, but hay i learned something new :-D

 

Again that for the help

 

Spear

Link to comment
Share on other sites

i installed this and while im pretty sure i got it correctly done  i keep getting a "sorry something went wrong please try again if it keeps failing please contact a admin! refunded itemsilverbar" i went thru the posts and maybe i missed something but i cant see where anyone else got this error where can i look

Link to comment
Share on other sites

If you have infistar - just add this so the key works

 

add here:_cMenu =

 

This:

"#USER:_keyMenu"

 

in AHconfig.

 

For some who didnt get the info at 1st page.

 

gratz

I added this to my AHconfig and changed the cMenu= true and nothing worked. But it's  fine without Infi?

running lastest Infistar also.

Any ideas?

Link to comment
Share on other sites

[RELEASE] Vehicle Key Changer - For making Masterkey - V 1.5 (Updated 10/05/2014)

Hi Guys,

i have a new update for you.

Changes: Bug Fixes & Claim Vehicle without a Key.

If you claim vehicles will a key generated and added to toolbelt.

You do not need a vehicle Key when you claim a vehicle :-)

Demo Video

https://www.youtube.com/watch?v=amrTvOEi-bw

Have Fun!

Best regards

hellraver

P.S. Sorry for my bad english. I speak German ;-)

Hint: This is a unofficial version and is not from Otternas3!!!

VehicleKeyChanger_v1.5.zip

Link to comment
Share on other sites

@RabidPanda01

I have no coin Server. I do not know how the script works Coin.

I think there will be a class name for the coins?

Where can I find the Coin scripts?

Then I could integrate it in Vehicle Key Changer.

@RamAthorn

I do not use infistar. But should work with infistar if it is in the white list.

Link to comment
Share on other sites

@RabidPanda01

I have no coin Server. I do not know how the script works Coin.

I think there will be a class name for the coins?

Where can I find the Coin scripts?

Then I could integrate it in Vehicle Key Changer.

@RamAthorn

I do not use infistar. But should work with infistar if it is in the white list.

i use this one  

Link to comment
Share on other sites

@RamAthorn

I tested just now vehicle key changer with nitrado admin tool.

Works beautifully with infistar ;-)

Best Regards

hellraver

I must be doing something wrong, but I know I'm close I can get it to start the act but

It keeps coming back with fail Refunded my money and says sorry something went wrong.

and this is in my RPT

13:53:48 Client: Remote object 3:7 not found

13:53:49 Warning: Cleanup player - person 3:6 not found

Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

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