Need script +REP
#1

Hey, I need a script that, from 12h to 22h turn on a function after an hour turn off. It should be fuction only one a day.

Sorry for bad English
Reply
#2

pawn Код:
forward HourCheck();
public HourCheck() {
    new h, m, s;
    static lH;
    gettime(h, m, s);
   
    if( h < 12 || h > 22 ) {
        return 0;
    }

    StartFunction();
   
    if(h == (lH + 1)) {
        StopFunction();
    }
    lH = h;
    return 1;
}

stock StopFunction() {

}

stock StartFunction() {

}
I can't understand what you want.. this?

pawn Код:
SetTimer("HourCheck", 1800000, 1);
In OnGameModeInit
Reply
#3

But I need random hour, 12h to 22h.
Reply
#4

Here's a way to call a function on a random time between 12 and 24 hours.

pawn Код:
#define RandMinMax(%0,%1) \
    random((%1-%0))+%0

SetTimer("HourCheck", RandMinMax(43200000, 86400000), 1);
Reply
#5

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Here's a way to call a function on a random time between 12 and 24 hours.

pawn Код:
#define RandMinMax(%0,%1) \
    random((%1-%0))+%0

SetTimer("HourCheck", RandMinMax(43200000, 86400000), 1);
oh, never came an idea like this on my mind
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)