Jump to content
  • 0
lwbuk

SQL object delete script

Question

Hi folks, Im getting myself in a mess trying to trim my database down from abandoned bases.

What Ive done so far:

All bases are indestructable. I want to keep this the case.

On the 18th, I ran a script to update all objects 'last updated' time to be the 18th.

I edited my init.sqf to have maintain when damage is 0

I editied fn_selfactions to make maintenance free

Ive pre warned all players that they must maintain thier bases every 7 days starting from the 21st.

 

What I want to acheive.. I thought I had saved an sql event in my bookmarks that would delete all objects that havent been updated in the previous 7 days, however I cant find it.

I found this one

 

Spoiler
DROP EVENT IF EXISTS `removeObjectOld`;
DELIMITER ;;
CREATE EVENT `removeObjectOld` ON SCHEDULE EVERY 1 DAY COMMENT 'Removes old objects and vehicles' DO DELETE FROM `Object_DATA` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 24 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 42 DAY)
;;
DELIMITER ;

But I tried it on my test server and it didnt delete anything. I changed the interval 24 day and interval 42 day to 1 day to try and it still didnt delete anything. SQL isnt my forte and I dont know what Im doing wrong.

I just want a scipt I can run that deletes anything that hasnt been updated in the previous 7 days, be it automatic or one I have to run manually.. I have navicat or phpmyadmin acsess to the database and seemingly can create events without any issues, as I have run a charcter data one without issues, I just dont know what the correct event is for this purpose!

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You need to set damage through database events and the hiveExt.ini halfway down says cleanupplaced after days  , set that to the amount of days you want .

Keep in mind the damage being done by the database event has to come to damage 1 for the cleanup from hiveExt to work .

so for example make the database do 0.2 damage every day is 1 damage in 5 days then the cleanup could be set to cleanupplaced after 6  days , but this is just an example  .

Share this post


Link to post
Share on other sites
  • 0

Thanks for the replys.

Currently Ive got the following mysql events running and defaultcleanup set to -1 in Hive.ext so Mysql does all the work, but something is confusing me.

Spoiler

DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 14 DAY) AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 DAY)

Spoiler

UPDATE `object_data` SET `Damage`=0.2 WHERE `ObjectUID` <> 0 AND `CharacterID` <> 0 AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') )

I did a test, where I placed some walls and shot them until they were are about 80/100 on damage. This allowed me to maintain via the plotpole as expected. By maintaining, they went back to 100/100 as they should.

I did another test, again, shot the wall until it was 80/100 and then waited for restart.

After restart, the wall was 100/100 again.

With this being the case, how is the sql cleanup going to work if all items go back to 100% after each restart, or does the SQL event force the damage to save to the database whereas shooting at the wall in game doesnt?

Sorry for such noob questions, I really do try figure out as much as I can on my own, but sometimes my head just refuses to work logically and I get stuck in a rut trying to figure stuff out!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By Warburgg
      Hello everyone. I would like to ask for help regarding a problem I have been having on my server.
      Items stored in the vault are not being stored in the SQL database.
      I have tested with the safe and the lockbox and both are not working but with the tent it works and saves the items in the database after the server restart.
      ArmA2OA.RPT: https://pastebin.com/X2cT7BBU
      arma2oaserve.RPT: https://pastebin.com/rqFNGbDy
      server_log.txt: https://pastebin.com/ZVWAzgNP
      Please help me. My players do not want to stay on the server because of this and if I remove the safe and leave only the tent (which is what saves the items) they will cry hahaha
    • By harcosgoogle
      Hi!
       
      Ref to nonnetwork object 3c14f900# 984738: wf_barracks_east.p3d  
      Log generated /1 sec (lag generated)
       
      RPT log
    • By harcosgoogle
      Hi!
       
      plotpole bug. Base maintanied ,The base has disappeared. Why?
       
      He was paid in vain
       
      Thanks!
    • By Dzhabrailov
      Hello! How to change the mapping of traders or 1.0.6.1 ?
    • By SryImAnooB
      Hey guys im trying to make a little script, which allows a player to delete a nearby Object. In that case a "Sr_border".
      First i did it like this:
      With Clickaction.
      removeBorder.sqf
      _nearBorder = nearestObject [player,"Sr_border"]; if (_nearBorder distance player < 5) then { {deleteVehicle _x} forEach nearestObjects [_player, ["Sr_border"], _range] } else { SystemChat "No Carspawn nearby!"; }; Worked pretty good, except for the problem, that after restart the border was back.
      I think thats because the {deleteVehicle _x} is exec. localy.
      So i tryed this:
      init.sqf
      "removecarspawn" addPublicVariableEventHandler { {deleteVehicle _x} forEach nearestObjects [_player, ["Sr_border"], _range] }; removeBorder.sqf
      _nearBorder = nearestObject [player,"Sr_border"]; _range = 5; _player = player; if (_nearBorder distance player < 5) then { publicVariable "removecarspawn"; } else { SystemChat "No Carspawn nearby!"; }; But its not working. Im a bit clueless, any tips for me?
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...