Genesis Posted May 13, 2014 Report Share Posted May 13, 2014 I've seen on some servers that they have scripts or events that set locked vehicles to unlocked after 10 days and delete after 14 days. Or even a script/event that deletes vehicles with missing wheels, both of these would help keep the amount of unused vehicles on the map down. Thanks in advance ~Genesis Link to comment Share on other sites More sharing options...
0 Michael_notfromCCG Posted May 14, 2014 Report Share Posted May 14, 2014 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 Link to comment Share on other sites More sharing options...
0 Genesis Posted May 14, 2014 Author Report Share Posted May 14, 2014 I will create events for both of these, hopefully they work =D! Thankyou so much. Link to comment Share on other sites More sharing options...
0 Genesis Posted May 14, 2014 Author Report Share Posted May 14, 2014 UPDATE object_data SET charID = 0 WHERE `datestamp` < DATE_SUB(NOW(), INTERVAL 10 DAY); [Err] 1054 - Unknown column 'charID' in 'field list' Instead of charID do you mean CharacterID maybe ObjectID or ObjectUID? Link to comment Share on other sites More sharing options...
0 Michael_notfromCCG Posted May 14, 2014 Report Share Posted May 14, 2014 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 ; Link to comment Share on other sites More sharing options...
Question
Genesis
I've seen on some servers that they have scripts or events that set locked vehicles to unlocked after 10 days and delete after 14 days.
Or even a script/event that deletes vehicles with missing wheels, both of these would help keep the amount of unused vehicles on the map down.
Thanks in advance
~Genesis
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now