Callback being called on hour starts
#1

Is there a callback that's being called on hour starts (at 0:00, at 1:00, ... 16:00 etc.)?
Reply
#2

No I think,

But Timers are used to count ONtime of player which will be under OnPlayerConnect.
Reply
#3

Quote:
Originally Posted by Bingo
Посмотреть сообщение
No I think,

But Timers are used to count ONtime of player which will be under OnPlayerConnect.
This can't depend on players online. And yes, I can create a timer, that checks constantly if new hour has started, but that seems to be such a waste... need a callback.
Reply
#4

Why do you need an timer that checks if an hour passed?
Just create a timer who gets called each hour

pawn Код:
SetTimer("EachHour", 1000 * 60 * 60, true);
To sycn it with the clock you just calculate the remaining seconds and call than the timer
pawn Код:
// OnGameModeInit
    HourTimer();
// global
forward HourTimer();
public HourTimer() {
    // code

    new
        hour,
        minute,
        second
    ;
    gettime(hour, minute, second);
    SetTimer("HourTimer", (3599 - minute * 60 - seconds) * 1000, false);
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)