robbiedarza Posted January 17, 2014 Report Share Posted January 17, 2014 Hello there, I have a lot of locked vehicles all over my map, and I cant delete them in case they are still being used. So I was wondering if there was a script or something that would auto delete vehicles that have not been used within a month. Many thanks Robbie Link to comment Share on other sites More sharing options...
0 Sukkaed Posted January 17, 2014 Report Share Posted January 17, 2014 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 Link to comment Share on other sites More sharing options...
0 robbiedarza Posted January 17, 2014 Author Report Share Posted January 17, 2014 Thank you very much for the reply mate. What do I do with that line please? Do I need to add it into one of the files in my server pbo? Many thanks robbie Link to comment Share on other sites More sharing options...
0 Picking Posted January 17, 2014 Report Share Posted January 17, 2014 Make a event in your DB and add that into it Link to comment Share on other sites More sharing options...
0 robbiedarza Posted January 17, 2014 Author Report Share Posted January 17, 2014 Ok thank you very much, I am using dayz.st does anyone know what i have to do plz? Never done anything like that many thanks robbie Link to comment Share on other sites More sharing options...
0 cletus Posted January 18, 2014 Report Share Posted January 18, 2014 Ok thank you very much, I am using dayz.st does anyone know what i have to do plz? Never done anything like that many thanks robbie not sure if dayz.st allows access to the database, but you would connect to your mysql database, and depending on the app used to connect the database, click events and new event from there. i use navicat to connect to the database. i also had to run this query as events were turned off by default SET GLOBAL event_scheduler = ON; Link to comment Share on other sites More sharing options...
0 mysticviperx Posted January 18, 2014 Report Share Posted January 18, 2014 We have done this on out server, but in a odd and roundabout way. First, we have updated our Hive.dll to change how it handles the database. It loads the Modular Building objects first, then the vehicles, just like the 1.0.4 Hive.dll will (all this was done in house before the the 1.0.3 update.) It also handles the object age updating, by doing in inside the hive.dll instead of an event in the database. We disabled the 'UPDATE CURRENT TIME' event in the database that was triggered every time a vehicle was altered. Then we setup events for the database to run different cleanups: First it checks of the vehicle is locked, if so (and it isnt a fuel truck) and its a week old then it changes the 'character id' variable from what ever key value to '0', thus unlocking the vehicle permanently. It also updates the vehicle's time stamp to the current time. Next it looks for unlocked vehicles that are 6 days old and repairs them to 100%, but it does not update the vehicle's 'Last_Updated' varible. Finally it looks for vehicles that have not been touched in 7 days, and are fully repaired, if its true, It deletes the vehicle. Its quite nice and helps rotate the vehicles out of my server and clean up vehicles left play inactive player, and its completely customizable. If there is any one interested, i can offer a tutorial on all the steps to do this. Link to comment Share on other sites More sharing options...
0 cayote Posted January 18, 2014 Report Share Posted January 18, 2014 We have done this on out server, but in a odd and roundabout way. First, we have updated our Hive.dll to change how it handles the database. It loads the Modular Building objects first, then the vehicles, just like the 1.0.4 Hive.dll will (all this was done in house before the the 1.0.3 update.) It also handles the object age updating, by doing in inside the hive.dll instead of an event in the database. We disabled the 'UPDATE CURRENT TIME' event in the database that was triggered every time a vehicle was altered. Then we setup events for the database to run different cleanups: First it checks of the vehicle is locked, if so (and it isnt a fuel truck) and its a week old then it changes the 'character id' variable from what ever key value to '0', thus unlocking the vehicle permanently. It also updates the vehicle's time stamp to the current time. Next it looks for unlocked vehicles that are 6 days old and repairs them to 100%, but it does not update the vehicle's 'Last_Updated' varible. Finally it looks for vehicles that have not been touched in 7 days, and are fully repaired, if its true, It deletes the vehicle. Its quite nice and helps rotate the vehicles out of my server and clean up vehicles left play inactive player, and its completely customizable. If there is any one interested, i can offer a tutorial on all the steps to do this. Sounds pretty sweet....can you post info on how to do this? I'm mostly a beginner at setting up the events...although I am learning a bit :) Link to comment Share on other sites More sharing options...
0 mysticviperx Posted January 18, 2014 Report Share Posted January 18, 2014 yeah, ill set one up. I wont go much into the explanation, just do this and this and this type post. And you will need my custom hive.dll, i need to make sure its ok to give that out. (for both you and me) You will need some spicific tools and access to your server, from what i have heard about gsp's, that shouldnt be a problem. Link to comment Share on other sites More sharing options...
0 robbiedarza Posted January 18, 2014 Author Report Share Posted January 18, 2014 Ok thank you for the replies and the help guys, it seems a little bit over my head but ill have a go. Many thanks all Robbie Link to comment Share on other sites More sharing options...
0 mysticviperx Posted January 18, 2014 Report Share Posted January 18, 2014 With the immanent release of 1.0.4 and the epoch devs doing the same with the hive.dll and other database settings, I will postpone the Tutorial until the release of 1.0.4 and i have compared their work to our own. Some things in the tutorial will be incompatible with the new hive.dll. Cramps2 1 Link to comment Share on other sites More sharing options...
0 Sukkaed Posted January 20, 2014 Report Share Posted January 20, 2014 Never heard of host that doesn't allow access to database :o Lets not make this too complicated. There is link to your database at Dayz.st control panel. Go there choose your epoch table and run this under SQL. CREATE EVENT DeleteOldVehicles ON SCHEDULE EVERY 1 DAY COMMENT 'Removes unused vehicles' DO 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 I would do it with shorter timeline like 10 days. Link to comment Share on other sites More sharing options...
0 WWKHeadhunter Posted January 24, 2014 Report Share Posted January 24, 2014 thanks for this info. anyway to edit the sql?. i added it with the 30 days and thats just to long Link to comment Share on other sites More sharing options...
0 Sukkaed Posted January 24, 2014 Report Share Posted January 24, 2014 Change wanted time here: DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY) Link to comment Share on other sites More sharing options...
0 Sukkaed Posted January 24, 2014 Report Share Posted January 24, 2014 To remove events that you have added use this: drop event if exists CapS_SenSitiVe_EvenT_Name; So in this case it would be: drop event if exists DeleteOldVehicles; Link to comment Share on other sites More sharing options...
0 gopostal Posted January 25, 2014 Report Share Posted January 25, 2014 Never heard of host that doesn't allows access to database :o Lets not make this too complicated. Thank you for that. Added to my server just now. What a great community this is. Link to comment Share on other sites More sharing options...
0 wrxman2004 Posted February 17, 2014 Report Share Posted February 17, 2014 will this remove base parts like walls and such? i run a server with a small player base and i set it up so you dont have to maintain the base parts and they stay forever. i just want to remove some of the random locked helis and such with out removing base parts Link to comment Share on other sites More sharing options...
0 Sukkaed Posted February 17, 2014 Report Share Posted February 17, 2014 No, walls and such don't have inventory. Like it is stated here: `Inventory` <> '[]' AND `Inventory` IS NOT NULL Link to comment Share on other sites More sharing options...
0 DangerRuss Posted June 20, 2014 Report Share Posted June 20, 2014 Would this only delete unused vehicles if their inventory is empty? I have a lot of abandoned vehicles from players who no longer play on the server. I'd like to remove the vehicles even if their inventory is full. Link to comment Share on other sites More sharing options...
0 Logan Posted July 5, 2014 Report Share Posted July 5, 2014 Would this only delete unused vehicles if their inventory is empty? I have a lot of abandoned vehicles from players who no longer play on the server. I'd like to remove the vehicles even if their inventory is full. Anyone have a trigger for this? I have so many vehicles on my Chernarus server from players who left. DangerRuss 1 Link to comment Share on other sites More sharing options...
0 vRazgriz Posted December 28, 2014 Report Share Posted December 28, 2014 I had a hacker on my server that spawned a bunch of locked vehicles, and I tired adding an event to the database, however the database keeps rejecting the event. I have tired clearing them from the database, but they just keep spawning back in locked. Link to comment Share on other sites More sharing options...
0 DangerRuss Posted December 29, 2014 Report Share Posted December 29, 2014 better to just roll back the database at that point Link to comment Share on other sites More sharing options...
Question
robbiedarza
Hello there, I have a lot of locked vehicles all over my map, and I cant delete them in case they are still being used.
So I was wondering if there was a script or something that would auto delete vehicles that have not been used within a month.
Many thanks
Robbie
Link to comment
Share on other sites
21 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