• 0
VirtualMechanic

Anyone know or have a good script to unlock not used vehicles after x days?

Question

Hi everyone,

I am looking for a script or SQL code that I can put in my server to unlock not moved/used vehicles after 'x' days.
This way I want to keep the server clean without it just being deleted so people have more ways of stealing stuff as well.

I know this can be done by some MySQL scripting, but I by far no pro in that... so I would appreciate a script or some help of someone who does know his way!



Cheers,

VM

Edited by VirtualMechanic

Share this post


Link to post
Share on other sites

5 answers to this question

  • 1
1 hour ago, VirtualMechanic said:

that's deleting yeah, I want a second option, to only unlock after x days.

Sorry about that. I misread. :)

1 person likes this

Share this post


Link to post
Share on other sites
  • 0
29 minutes ago, BetterDeadThanZed said:

There's a setting in your config.cpp that deletes vehicles not used in X number of days. By default it's 3 days. I don't remember which config.cpp, but it's there.

that's deleting yeah, I want a second option, to only unlock after x days.


Example:
after 3 days car unlocks, after 7 days car gets deleted (if not interacted with)

Edited by VirtualMechanic

Share this post


Link to post
Share on other sites
Advertisement
  • 0

I have fiddled a bit with it, and I think the code should look something like this below:
 

Spoiler

; Unlock vehicles after ? days
[UnlockOldVehicles]
SQL1_1 = UPDATE vehicle SET is_locked = 0 WHERE last_updated_at < DATE_SUB(NOW(), INTERVAL ? DAY) AND deleted_at IS NULL
Number Of Inputs = 1
SQL1_INPUTS = 1


 


Tho I am not sure where and how I can set the interval time, and probably need something to define that, and I might have some syntax errors too (first try ever that I wrote some SQL script..)
 

Edited by VirtualMechanic

Share this post


Link to post
Share on other sites
  • 0
3 minutes ago, BetterDeadThanZed said:

Sorry about that. I misread. :)

Yeah I thought so ;-)
Tho my explanation could have been clearer too

anyway, lets see if we have some SQL/SQF wizards here  

Share this post


Link to post
Share on other sites
  • -1

There's a setting in your config.cpp that deletes vehicles not used in X number of days. By default it's 3 days. I don't remember which config.cpp, but it's there.

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.