SA-MP Forums Archive
Need script +REP - 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: Need script +REP (/showthread.php?tid=349835)



Need script +REP - arman'as - 10.06.2012

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


Re: Need script +REP - ReVo_ - 10.06.2012

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


Re: Need script +REP - arman'as - 10.06.2012

But I need random hour, 12h to 22h.


Re: Need script +REP - iggy1 - 10.06.2012

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);



Re: Need script +REP - ReVo_ - 10.06.2012

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