SA-MP Forums Archive
Info: Gettime - 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: Info: Gettime (/showthread.php?tid=370659)



Info: Gettime - NewbieScripter - 20.08.2012

how to use gettime ?

my question is, how to transform this with a gettime or gettickcount, is possible ? this example uses a timerex

Код:
if(example[playerid] != 0)
{

    SetTimerEx("@reset", 4000, false, "d", playerid);

    return 1;
}
Код:
forward @Reset(playerid);

@Reset(playerid)
{
    // functions here

    return 1;
}



Re: Info: Gettime - NewbieScripter - 20.08.2012

??


Re: Info: Gettime - Ranama - 20.08.2012

what do you mean, do you want this function to get called like every 4 seconds? then this is the best way, otherwise you should have to check the time every second and see if it equals to the time it should be called, witch means a faster tick-count on the timer and that will be harder for your server.

(if that's not what you mean, please explain a bit more.)


Re: Info: Gettime - NewbieScripter - 20.08.2012

mhm explain me the tickcount D:


Re: Info: Gettime - Ranama - 20.08.2012

what do you mean with the tick count?
There is no function that gets called every second, that's why if you want one you'll have to set a timer like:

pawn Код:
forward TickCountFunction();
SetTimer("TickCountFunction", 1000, true);
//and then you'll have to make the tickcount function:


public TickCountFunction(){
//do the thing you want to be done every second here.
}
That's how you do a function that gets called every second, but if you want to do something every 4 second it better just doing a timer that ONLY gets called every 4 second instead of making this and checking the time.
(I don't really know what you want to do yet but that was what i was thinking about.)