is this ok to use settimerex ?
#3

You don't even need a timer for this at all. Check out Unix timestamps. Tutorial somewhere in the tutorial section. You save a Unix timestamp when they login. When they disconnect you subtract the value you saved earlier from the current timestamp. This will give you a value in seconds which can easily be converted to hours and minutes when needed. Ergo, you don't need the 'Hour' and 'Min' variables either.

pawn Код:
stock sec_to_time(input_seconds, &hours, &minutes, &seconds)
{
    hours = input_seconds / 3600; // int divided by int is int
    input_seconds -= (hours * 3600);
   
    minutes = input_seconds / 60;
    input_seconds -= (minutes * 60);
   
    seconds = input_seconds;
}
pawn Код:
// e.g.:
new
    hours,
    minutes,
    seconds;

sec_to_time(4512, hours, minutes, seconds);
// hours = 1, minutes = 15, seconds = 12
Reply


Messages In This Thread
is this ok to use settimerex ? - by joec39 - 22.02.2015, 18:03
Re: is this ok to use settimerex ? - by Ritzy2K - 22.02.2015, 18:07
Re: is this ok to use settimerex ? - by Vince - 22.02.2015, 18:09
Re: is this ok to use settimerex ? - by AndySedeyn - 22.02.2015, 18:09

Forum Jump:


Users browsing this thread: 1 Guest(s)