[Help] Player inactivity timer - 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: [Help] Player inactivity timer (
/showthread.php?tid=357506)
[Help] Player inactivity timer -
jeffery30162 - 07.07.2012
I have a house system and I want to be able to add a timer so that it automatically detects if a player hasn't been on for 7 days.
Re: [Help] Player inactivity timer -
coole210 - 07.07.2012
You don't need a timer, save the date (try timestamp [date in seconds]) on the player's file. Then, when they login and it's been over 7 days compared to what is saved on their file, reset their house.
Or if you're using MySQL then it's easy to check with a timer (preferably repeat set to every hour). You just have to again save the LastLogin, and make a query checking if any players haven't logged in for 7 days or more and own a house (also you should add this method when they login to be safe).
Method for MySQL can be used as well if your file saving system is
SQLite.