An easy to reset home system to default
#1

Good evening, I want to do a system automatically delete the inactive house after a month?
That is, the houses buy after a while and those players do not enter the server..

can someone help me please nice?
Reply
#2

Well if you're using MySQL you can do something like...

Код:
DELETE FROM houses WHERE houseid < (CURDATE() - INTERVAL 30 DAYS);
Or..

Код:
CREATE EVENT delete_event
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 30 DAYS
ON COMPLETION PRESERVE

DO BEGIN
      DELETE houses WHERE houseid < DATE_SUB(NOW(), INTERVAL 30 DAYS);
END;
Or you can set a cronjob in your cPanel each 30 days, then link it to a .php file:

pawn Код:
<?php
 include 'your_db_connection';
 mysql_query("DELETE FROM houses WHERE houseid < NOW()");
?>
Reply
#3

do not use mysql, It's on .ini files
Reply
#4

Then i don't know. I suggest you to use mysql for this things. it's more fast and efficient.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)