rentiger1112 Posted September 27, 2014 Report Share Posted September 27, 2014 how would I make it so that vehicles unlock after 5 days of inactivity (mysql event)? Link to comment Share on other sites More sharing options...
0 3steN8igall Posted September 27, 2014 Report Share Posted September 27, 2014 UPDATE `object_data` SET CharacterID = 0 WHERE LastUpdated < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND CharacterID > 0 AND Classname NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage','Wooden_shed_DZ','GunRack_DZ','WoodCrate_DZ') AND Inventory <> '[]' AND Inventory IS NOT NULL here is mine sql event... works perfect Link to comment Share on other sites More sharing options...
0 rentiger1112 Posted September 27, 2014 Author Report Share Posted September 27, 2014 UPDATE `object_data` SET CharacterID = 0 WHERE LastUpdated < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND CharacterID > 0 AND Classname NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage','Wooden_shed_DZ','GunRack_DZ','WoodCrate_DZ') AND Inventory <> '[]' AND Inventory IS NOT NULL here is mine sql event... works perfect thanks Link to comment Share on other sites More sharing options...
0 PetuniaEpoch Posted September 28, 2014 Report Share Posted September 28, 2014 That one looks good - I'd double-check there's no new EPOCH lockable stuff been added that has locks etc though, I've seen that happen once I think (just need to make sure you add it to the array of NOT IN) :)thanks Link to comment Share on other sites More sharing options...
0 calamity Posted September 29, 2014 Report Share Posted September 29, 2014 UPDATE `object_data` SET CharacterID = 0 WHERE LastUpdated < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND CharacterID > 0 AND Classname NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage','Wooden_shed_DZ','GunRack_DZ','WoodCrate_DZ') AND Inventory <> '[]' AND Inventory IS NOT NULL here is mine sql event... works perfect will that always work or do I have to run the event every day ?? shouldn't it be a drop event ? im asking since I still dont understand sql stuff too well I just run that as a query and its there forever ? Link to comment Share on other sites More sharing options...
0 Rocu Posted September 30, 2014 Report Share Posted September 30, 2014 (edited) will that always work or do I have to run the event every day ?? shouldn't it be a drop event ? im asking since I still dont understand sql stuff too well I just run that as a query and its there forever ? This is the execution code for event. If you run this code now it will just run once. You need to make an event separately for this to keep running. Edit// In other words, this should be the correct code for making it an actual event: DROP EVENT IF EXISTS unlockUnusedVehicles; CREATE EVENT unlockUnusedVehicles ON SCHEDULE EVERY 4 HOUR COMMENT 'Unlocks any vehicle that has not been touched for 5 days' DO UPDATE `object_data` SET CharacterID = 0 WHERE LastUpdated < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND CharacterID > 0 AND Classname NOT IN ('VaultStorage','LockboxStorage','VaultStorageLocked','LockboxStorageLocked','WoodShack_DZ','StorageShed_DZ','TentStorageDomed','TentStorageDomed2','TentStorage','Wooden_shed_DZ','GunRack_DZ','WoodCrate_DZ') AND Inventory <> '[]' AND Inventory IS NOT NULL; ; Edited October 2, 2014 by Rocu Link to comment Share on other sites More sharing options...
0 Tricks Posted October 1, 2014 Report Share Posted October 1, 2014 Anyway to make this only affect cars that are NOT within a plot pole radius? Link to comment Share on other sites More sharing options...
0 cen Posted October 1, 2014 Report Share Posted October 1, 2014 Here's mine: /* Unlock Purchased Untouched Vehicles */ UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND `CharacterID` > 0 AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest'; Link to comment Share on other sites More sharing options...
0 monkeybrain Posted October 2, 2014 Report Share Posted October 2, 2014 Here's mine: /* Unlock Purchased Untouched Vehicles */ UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND `CharacterID` > 0 AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest'; So you just chuck that in the query and it just continues as a event? I suck with the database stuff :P Link to comment Share on other sites More sharing options...
0 Rocu Posted October 2, 2014 Report Share Posted October 2, 2014 (edited) So you just chuck that in the query and it just continues as a event? I suck with the database stuff :P >.< As I said like 3 posts above, you need to actually make it to an event first. That code he provided is the code that is supposed to execute every X day. It isn't the code that makes the "execute every X day" thing happen. Capiche? If you don't know how to make an event, use this code instead: DROP EVENT IF EXISTS unlockUnusedVehicles; CREATE EVENT unlockUnusedVehicles ON SCHEDULE EVERY 4 HOUR COMMENT 'Unlocks any vehicle that has not been touched for 5 days' DO UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND `CharacterID` > 0 AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest'; ; Now THIS is the code you can just chuck in the query and it starts looping itself every 5 days. (Haven't tested, but should work) Edited October 2, 2014 by Rocu Link to comment Share on other sites More sharing options...
0 cen Posted October 2, 2014 Report Share Posted October 2, 2014 Why would you only want it to run every 5 days? I run that every time one of my servers start... Link to comment Share on other sites More sharing options...
0 Rocu Posted October 2, 2014 Report Share Posted October 2, 2014 Why would you only want it to run every 5 days? I run that every time one of my servers start... You're right, my bad. OP wanted 5 days so it kind of got stuck in my mind and wrote 5 days everywhere :D . Edited my scripts above. Link to comment Share on other sites More sharing options...
0 Externized Posted October 2, 2014 Report Share Posted October 2, 2014 Here's mine: /* Unlock Purchased Untouched Vehicles */ UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND `CharacterID` > 0 AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest'; What exactly does this one do?? Link to comment Share on other sites More sharing options...
0 Rocu Posted October 2, 2014 Report Share Posted October 2, 2014 What exactly does this one do?? Well, in technical terms, it sets CharacterID to 0 (clears ownership / removes the need for a key) for any item, that has not been updated within 5 days. Exceptions include barrier, storage, shed, etc etc. The exception is necessary so that it doesn't reset things like safes, lockboxes, locked doors etc. So it applies only on vehicles. Link to comment Share on other sites More sharing options...
Question
rentiger1112
how would I make it so that vehicles unlock after 5 days of inactivity (mysql event)?
Link to comment
Share on other sites
13 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