Jump to content

Michael_notfromCCG

Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Michael_notfromCCG

  1.  

     

    Instead of charID do you mean CharacterID maybe ObjectID or ObjectUID?

     

     

    It will be characterID (sorry, wasn't at home PC). That stores the vehicle key number.

     

     

    Also worth trying, is the No Key cleanup. It comes in the recommended mysql events. It "should" delete all vehicles, where the key has been lost. It can be buggy from time to time, but is generally awesome. Run these 2 to create the functions, then simply run "SELECT DeleteNonKeyVehicles();" to delete those vehicles.

    -- ----------------------------
    -- Function structure for FindVehicleKeysCount
    -- ----------------------------
    DROP FUNCTION IF EXISTS `FindVehicleKeysCount`;
    DELIMITER ;;
    CREATE 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
    ;;
    DELIMITER ;
    
    -- ----------------------------
    -- Function structure for DeleteNonKeyVehicles
    -- Example usage: SELECT DeleteNonKeyVehicles();
    -- ----------------------------
    DROP FUNCTION IF EXISTS `DeleteNonKeyVehicles`;
    DELIMITER ;;
    CREATE FUNCTION `DeleteNonKeyVehicles`() RETURNS int(11)
    BEGIN
    	DELETE FROM
    		`Object_DATA`
    	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;
    
    	RETURN ROW_COUNT();
    END
    ;;
    DELIMITER ;
    
  2. Doing this from memory, at work so you may need to alter a couple of bits:

     

     

    "unlock" vehicles after 10 days:

    UPDATE object_data SET charID = 0 WHERE `datestamp` < DATE_SUB(NOW(), INTERVAL 10 DAY);
    

    Delete vehicles that are 14 days old:

    DELETE FROM object_data WHERE `datestamp` < DATE_SUB(NOW(), INTERVAL 14 DAY);
    

    As for the last one, I would need to be at my actual PC for that. Hope those other 2 queries help

  3. Nice. I have actually been working on something similar for my un-named community.

     

    Example - http://mtcaldwell.co.uk/newCCG.php

     

    Features:

    • Live Killboard
    • Top Hero
    • Top Bandit
    • Wealthiest player*

    Still a big work in progress, as I never knew any HTML, CSS, PHP or Javascript before I started, now I am using it all :D

     

    *Quite a smart query works this out. (obviously specific to our servers, due to currency). But it looks at how much money you have on you at the moment, how much you have in the bank and calculates the value of all your stored gold and briefcases. Does this and works how who is the richest on the server. (Broken just now, so won't load. I accidentally broke it when trying to do some optimizing to make the query responsible work quicker). This query could be adapted to servers that use the standard currency, assuming you have playerID attached to objects.

     

    I'd be happy to exchange notes.

  4. UPDATE character_data SET `inventory` = REPLACE(`inventory`,'BAF_AS50_scoped_DZ','MR43');
    UPDATE character_data SET `backpack` = REPLACE(`backpack`,'BAF_AS50_scoped_DZ','MR43');
    UPDATE object_data SET `inventory` = REPLACE(`inventory`,'BAF_AS50_scoped_DZ','MR43');
    

    Run a query with the above in it.

     

    It is difficult to remove something from the database, due to the way that the inventory system works in the database. The SQL code above will replace the AS50 with MR43 (Double Barrel Shotgun). There are numerous variants of AS50 though, so make sure you have the right one.

     

    Hope that helps :)

×
×
  • Create New...