Cleaning up DB dead players?

Marine

New Member
Is there a script I can run that will clean up all the " is_dead" survivor rows from the Survivor table in my database?
I realize I will have to backup and remove the Instance_deplayables because they are linked to the survivors and you run into an error if you try and delete a survivor that has placed a tent.
But lets say I go ahead and backup that table delete it, I just need a simple script to run every now and then to clean up my survivor pages. Once it starts getting to 30+ pages it gets annoying to scroll through and manually delete them. Would save much more time.

Is there a script in existance already for this?
 
If u have bliss change character_data to ur table name!
Code:
DELETE FROM character_data where
 
field1 like '%is_dead%'
OR
field2 like '%is_dead%'
OR
...
fieldLast like '%is_dead%'
 
for bliss:

Code:
delete from survivor
 where is_dead = 1
 and id not in (
  select owner_id from instance_deployable
 );
 
Awesome JoSchaap, this works how I wanted it to.

But I got an idea while testing this out. This script only runs if the player has no instance_deployable attached to their name. So if I were to create a row in my Survivor table giving it a fake UniqueID like 1234.

How would I make this script run just like it does, but if it runs into the issue of any of the survivors having a instance_deployable it would automatically change the unique_id for that specific deployable to the static fake Unique ID that will never be used I created in the survivor table..1234... i created. then continue deleting the rest? Or is that more difficult to make it do that?
If that doesnt make sense, let me know. Ill try and rephrase it in a better way.
 
if you go through such lengths.. why not just delete the tent, or just remove the foreign key so it wont bug about having tents left?
 
well, survivors die.. it would really suck to place a tent down fill it up with some gear then die by zombies or bandits whatever the case may be. If I have the tents deleting everytime the player dies there is no point to even having tents or even attempting to save gear into a tent.
But ill try removing the foreign key and seeing how that works out.

Thanks
 
The utility.pl has this feature, if using Bliss :)
Run in cmd
Code:
perl utility.pl  --cleandead <days>
INFO: "delete dead survivors who were last updated more than <days> days ago"

You can add, or edit utility.pl:
--database xxx
--password xxx
--user xxx
--instance xxx
--host xxx
--port xxx

We created a simple .bat file to ensure this and vehicle spawn is running at every restart.
 
Back
Top