Jump to content

Key's


Luna

Recommended Posts

You can search the database manually but it is a pain.

I have created a script that can tell you if the vehicle still exists in the database while you are still in-game, it is much quicker and easier than manually searching.

It also tells you what vehicle the key belongs to, if the vehicle does still exists in the database.

You can get it here: (There is a version without map markers)

 

If you really want to do it manually to understand how it works, you should use the key's class name instead of its display name. For example:

The key's display name may be "Black Key (7a96)", but its class name is "ItemKeyBlack1168". You can get the class name of the key from the players inventory (Or wherever the key is stored) in the database. 

 

You can take the number from the end of the class name and do a simple conversion - (number + key colour = vehicle CharacterID)

 

Key colour:

Green = + 0
Red = + 2500
Blue = + 5000
Yellow = + 7500
Black = + 10000
 
So for "ItemKeyBlack1168", the vehicle CharacterID in the database would be 11168, because black = + 10000.
If you had "ItemKeyRed1670" the vehicle CharacterID would be 4170, because red = +2500. Therefore 1670 + 2500 = 4170.

If you had "ItemKeyYellow1272" the vehicle CharacterID would be 8772, because yellow = +7500. Therefore 1272 + 7500 = 8772.

 

And so on.

 

Once you know the vehicle's CharacterID, you can check if it still exists in the database.

 

Link to comment
Share on other sites

Hi

I have a quick question.

If I know the key number of a key e.g. cd07– can I somehow search the database to see if that car is still in game ?

/Luna

I believe this may help  >>>>>>>>>>>>>>>>>>>>NOT TESTED<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 

if no key exists in database this "should" unlock em

 

UPDATE

`Object_DATA`
SET
`Object_DATA`.`CharacterID` = 0
WHERE
`Object_DATA`.`CharacterID` <> 0
AND `Object_DATA`.`CharacterID` <= 12500
AND `Object_DATA`.`Classname` NOT LIKE 'Tent%'
AND `Object_DATA`.`Classname` NOT LIKE '%Locked'
AND `Object_DATA`.`Classname` NOT LIKE 'Land%'
AND `Object_DATA`.`Classname` NOT LIKE 'Cinder%'
AND `Object_DATA`.`Classname` NOT LIKE 'Wood%'
AND `Object_DATA`.`Classname` NOT LIKE 'Metal%'
AND `Object_DATA`.`Classname` NOT LIKE '%Storage%'
AND `Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ')
			AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0
Link to comment
Share on other sites

 

I believe this may help  >>>>>>>>>>>>>>>>>>>>NOT TESTED<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 

if no key exists in database this "should" unlock em

 

 

 

And you're missing the key part of this query, which is FindVehicleKeysCount.

To add it as a function your database, use this query:

CREATE DEFINER=`root`@`localhost` FUNCTION `FindVehicleKeysCount`(`keyId` INT) RETURNS int(11)
BEGIN
    DECLARE totalKeys INT DEFAULT 0;
    DECLARE keyName VARCHAR(32) DEFAULT "";
    DECLARE keysInChar INT DEFAULT 0;
    DECLARE keysInObj INT DEFAULT 0;

    SET keyName = (CASE
        WHEN `keyId` < 2501 THEN CONCAT('ItemKeyGreen', `keyId`)
        WHEN `keyId` < 5001 THEN CONCAT('ItemKeyRed', `keyId` - 2500)
        WHEN `keyId` < 7501 THEN CONCAT('ItemKeyBlue', `keyId` - 5000)
        WHEN `keyId` < 10001 THEN CONCAT('ItemKeyYellow', `keyId` - 7500)
        WHEN `keyId` < 12501 THEN CONCAT('ItemKeyBlack', `keyId` - 10000)
        ELSE 'ERROR'
    END);

    SET keysInChar = (SELECT COUNT(*) FROM `Character_DATA` WHERE `Alive` = '1' AND (`Inventory` LIKE CONCAT('%', keyName, '%') OR `Backpack` LIKE CONCAT('%', keyName, '%')));
    SET keysInObj = (SELECT COUNT(*) FROM `Object_DATA` WHERE `Inventory` LIKE CONCAT('%', keyName, '%'));

    RETURN (keysInChar + keysInObj);
END

Note the first line `root`@`localhost`. You need to change these accordingly. 

 

And as Logi said, this really isn't what the topic creator is looking for. But I posted the function anyway in case someone wants that instead.

Link to comment
Share on other sites

Can you clearfy this for me - plz

 

 

 

Note the first line `root`@`localhost`. You need to change these accordingly. 

 

I tryed

 

root = Database name

localhost = database hostname

 

but that does not work  :huh:

 

I will defintly try Logi script aswell - But yea its 2 diffent thing, both would be nice though  ;)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...