SA-MP Forums Archive
An easy to reset home system to default - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: An easy to reset home system to default (/showthread.php?tid=657614)



An easy to reset home system to default - rollercaster - 11.08.2018

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?


Re: An easy to reset home system to default - KinderClans - 11.08.2018

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()");
?>



Re: An easy to reset home system to default - rollercaster - 11.08.2018

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


Re: An easy to reset home system to default - KinderClans - 11.08.2018

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