Problem - Days System
#7

Have a variable to store the time in which the lease will expire
Код:
House[houseid][ExpirationDate] = gettime() + 60 * 60 * 24 * 30 //The current timestamp with addition of 30 days, converted to seconds
And set a timer that will check every minute or every hour if the timestamp has been reached or exceeded
Код:
House[houseid][ExpirationTimer] = SetTimerEx("CheckTimestamp", 60 * 1000 * 60, true, "i", houseid);

forward CheckTimestamp(houseid);
public CheckTimestamp(houseid)
{
    if(gettime() >= House[houseid][ExpirationDate]) {
        //Date reached
        KillTimer(House[houseid][ExpirationTimer]);
        //Do whatever you want here
    }
    return 1;
}
That code would check every hour(to prevent spamming the server with checks) if the 30 days has passed.
Reply


Messages In This Thread
Problem - Days System - by TheHonnor - 28.07.2016, 12:36
Re: Problem - Days System - by Logic_ - 28.07.2016, 12:41
Re: Problem - Days System - by F1N4L - 28.07.2016, 12:57
Re: Problem - Days System - by WhiteGhost - 28.07.2016, 12:57
Re: Problem - Days System - by TheHonnor - 28.07.2016, 13:22
Re: Problem - Days System - by Stuntff - 28.07.2016, 13:31
Re: Problem - Days System - by [XST]O_x - 28.07.2016, 13:40
Re: Problem - Days System - by TheHonnor - 29.07.2016, 09:13
Re: Problem - Days System - by Logic_ - 29.07.2016, 09:16
Re: Problem - Days System - by [XST]O_x - 29.07.2016, 14:08

Forum Jump:


Users browsing this thread: 1 Guest(s)