Time - 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: Time (
/showthread.php?tid=548121)
Time -
Clarck - 27.11.2014
hello .. how can I do a timer to automatically release a property if the owner does not log within 10 days?
Re: Time -
Jonesy96 - 27.11.2014
You're better off setting up a CRON job in PHP or something to run every midnight to release the house via the database.
Re: Time -
Schneider - 27.11.2014
Set a timer with a 864-million interval.... But you'll have to keep your server running 24/7 to work.
A better way would be to store the date and time the player disconnects in his player-file or property-file and create a function that compares that date with the current date and takes action if 10 days has passed.
Re: Time -
iggy1 - 27.11.2014
If i was you id save when player was last logged in. Not use a timer.
pawn Код:
new OwnerLastLoggedIn;//somewhere
then when they log in or out
pawn Код:
OwnerLastLoggedIn = gettime();
Then when someone tries to buy a property.
pawn Код:
//"gettime() - OwnerLastLoggedIn" will be the amount of seconds passed since last login
if((gettime() - OwnerLastLoggedIn) >= 864000)//864000 10 days in seconds
{
//player can buy property owner was last logged in 10 days or more ago
}
Re: Time -
Clarck - 28.11.2014
ok thank you I will try