Jump to content
  • 0

Add Database Event


TylerHumor

Question

I'd like to add an event into my database that cleans up vehicles that haven't moved in a specified amount of time, BUT only if they don't have gear in them.

 

My guess:

EventName: removeUntouchedVehicles

Status: Enabled

Execute Every: (Number that I choose)_Day

Start: (Whenever I start it) Ex:2015-01-24 22:31:37

End: (Blank)

Definition: DELETE FROM `object_data` WHERE Inventory = 0 <--(Not sure how to edit the "not being touched part, I assume it'd be with "worldspace".)

Definer: (MyInfo)

Comment: Removes Untouched and Empty vehicles

I would place this info into a new event in my database. Hopefully I'm not far off.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I personally use this:

DELETE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)  //where not updated for 3 days (this includes no damage, inventory, worldspace updates?)
AND `CharacterID` > 0 // character id is larger than zero (will not clean up dynamically spawned vehicles)
AND `Classname` NOT LIKE 'Tent%' // so that all non vehicles are ignored
AND `Classname` NOT LIKE '%Locked'
AND `Classname` NOT LIKE 'Land\_%'
AND `Classname` NOT LIKE 'Cinder%'
AND `Classname` NOT LIKE 'Wood%'
AND `Classname` NOT LIKE 'Metal%'
AND `Classname` NOT LIKE '%Storage%'
AND `Classname` NOT IN ('OutHouse_DZ','GunRack_DZ','WorkBench_DZ','Sandbag1_DZ','FireBarrel_DZ','DesertCamoNet_DZ','StickFence_DZ','LightPole_DZ','DeerStand_DZ','ForestLargeCamoNet_DZ','DesertLargeCamoNet_DZ','Plastic_Pole_EP1_DZ','Hedgehog_DZ','FuelPump_DZ','Fort_RazorWire','SandNest_DZ','ForestCamoNet_DZ','Fence_corrugated_DZ','CanvasHut_DZ','Generator_DZ','BagFenceRound_DZ')
AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Inventory` = '[[[],[]],[[],[]],[[],[]]]') ) //empty inventory
;

 

I don't think Inventory = 0 will work (as it doesn't come up as 0). Please correct me if wrong.

Link to comment
Share on other sites

  • 0

 

I personally use this:

DELETE FROM `object_data`
WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)  //where not updated for 3 days (this includes no damage, inventory, worldspace updates?)
AND `CharacterID` > 0 // character id is larger than zero (will not clean up dynamically spawned vehicles)
AND `Classname` NOT LIKE 'Tent%' // so that all non vehicles are ignored
AND `Classname` NOT LIKE '%Locked'
AND `Classname` NOT LIKE 'Land\_%'
AND `Classname` NOT LIKE 'Cinder%'
AND `Classname` NOT LIKE 'Wood%'
AND `Classname` NOT LIKE 'Metal%'
AND `Classname` NOT LIKE '%Storage%'
AND `Classname` NOT IN ('OutHouse_DZ','GunRack_DZ','WorkBench_DZ','Sandbag1_DZ','FireBarrel_DZ','DesertCamoNet_DZ','StickFence_DZ','LightPole_DZ','DeerStand_DZ','ForestLargeCamoNet_DZ','DesertLargeCamoNet_DZ','Plastic_Pole_EP1_DZ','Hedgehog_DZ','FuelPump_DZ','Fort_RazorWire','SandNest_DZ','ForestCamoNet_DZ','Fence_corrugated_DZ','CanvasHut_DZ','Generator_DZ','BagFenceRound_DZ')
AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Inventory` = '[[[],[]],[[],[]],[[],[]]]') ) //empty inventory
;

 

I don't think Inventory = 0 will work (as it doesn't come up as 0). Please correct me if wrong.

 

This error occured when placing this into a new event in my database:

 

The following query has failed: "CREATE DEFINER=`ss4560Tyler`@`%` EVENT `removeUntouchedVehicles` ON SCHEDULE EVERY 1 DAY STARTS '2015-01-25 00:00:00.000000' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'Removes Untouched and Empty vehicles' DO DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) //where not updated for 3 days (this includes no damage, inventory, worldspace updates?) AND `CharacterID` > 0 // character id is larger than zero (will not clean up dynamically spawned vehicles) AND `Classname` NOT LIKE 'Tent%' // so that all non vehicles are ignored AND `Classname` NOT LIKE '%Locked' AND `Classname` NOT LIKE 'Land\_%' AND `Classname` NOT LIKE 'Cinder%' AND `Classname` NOT LIKE 'Wood%' AND `Classname` NOT LIKE 'Metal%' AND `Classname` NOT LIKE '%Storage%' AND `Classname` NOT IN ('OutHouse_DZ','GunRack_DZ','WorkBench_DZ','Sandbag1_DZ','FireBarrel_DZ','DesertCamoNet_DZ','StickFence_DZ','LightPole_DZ','DeerStand_DZ','ForestLargeCamoNet_DZ','DesertLargeCamoNet_DZ','Plastic_Pole_EP1_DZ','Hedgehog_DZ','FuelPump_DZ','Fort_RazorWire','SandNest_DZ','ForestCamoNet_DZ','Fence_corrugated_DZ','CanvasHut_DZ','Generator_DZ','BagFenceRound_DZ') AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Inventory` = '[[[],[]],[[],[]],[[],[]]]') ) //empty inventory ;"

MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/where not updated for 3 days (this includes no damage, inventory, worldspace up' at line 2

NEVERMIND.. I am an idiot..

 

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...