Jump to content
  • 0

After someone who knows there SQL


SheepishShaun

Question

So I have a server and there are quite a few locked vehicles just sitting around taking up space, I want to put in an event like:

DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY) AND `CharacterID` > 0 AND `Classname` NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked') AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL

But instead of deleting them, I want to teleport them to the volcano on the tavi map, as like a storage area, just incase someone wants their vehicle back. I would like to teleport them after about 60 days of inactivity, but i'm not too keen on deleting.

Can this be done?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Teleporting would require a script/ server monitor and would probably be more trouble than it's worth. However, if you're interested in it, I'd probably start with the code from a safezone teleport script. Also, nobody is going to expect their car to be there after two months of inactivity.

Unlocking them after a certain time would by far be the easiest, and look something like this: 

UPDATE `object_data` SET `CharacterID` = 0
    WHERE `LastUpdated` <= DATE_SUB(NOW(), INTERVAL 30 DAY)
        AND `Datestamp` < DATE_SUB(NOW(), INTERVAL 45 DAY);

Which would unlock vehicles/ safes and really any object that was last updated at least 30 days ago and at least 45 days old. Adjust to your liking. Make sure you understand this before running though, I just typed it up really fast and probably am forgetting something. Make a db backup before using :)

Edited by kelso000
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
  • Discord

×
×
  • Create New...