an issue with (SetTimer) - 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: an issue with (SetTimer) (
/showthread.php?tid=585761)
an issue with (SetTimer) -
YoussefHammad - 16.08.2015
i'm trying to change the time that the action of starting moneybag happens but i cant really understand the script (PS: this moneybag system is not mine but here are the lines that you need)
Код:
new Timer[2];
#define MoneyBagDelay(%1,%2,%3,%4) (%1*3600000)+(%2*60000)+(%3*1000)+%4
#define MB_DELAY MoneyBagDelay(0, 10, 0, 0)
public OnFilterScriptInit()
{
Timer[1] = SetTimer("MoneyBag", MB_DELAY, true);
return 1;
}
Thanks
Re: an issue with (SetTimer) -
jlalt - 16.08.2015
PHP код:
SetTimer("funcname", interval, repeating);
Re: an issue with (SetTimer) -
YoussefHammad - 16.08.2015
Quote:
Originally Posted by jlalt
PHP код:
SetTimer("funcname", interval, repeating);
|
i know i searched samp wiki , but it doesnt look like it in this case
Re: an issue with (SetTimer) -
Evocator - 16.08.2015
This is just stupid tbh. Its a define of converting a specific amount of time to milliseconds.
#define MoneyBagDelay(
%1,
%2,
%3,
%4) (
%1*3600000)+(
%2*60000)+(
%3*1000)+
%4
As you can see that the MoneyBagDelay has 4 parameters. Each one is then set to be multiplied with a specific number that converts it to milliseconds.
Now when MB_DELAY is defined as MoneyBagDelay(0, 10, 0, 0)
it means that the timer should run every:
MoneyBagDelay(
hour,
min,
sec,
millisecond)
Which in your case it is:
0 hour,
10 mins,
0 seconds,
0 milliseconds
And now, only 10 mins are converted to milliseconds, which means that the timer runs once every 10 mins.
Re: an issue with (SetTimer) -
YoussefHammad - 16.08.2015
Quote:
Originally Posted by Ralfie
This is just stupid tbh. Its a define of converting a specific amount of time to milliseconds.
#define MoneyBagDelay(%1,%2,%3,%4) (%1*3600000)+(%2*60000)+(%3*1000)+%4
As you can see that the MoneyBagDelay has 4 parameters. Each one is then set to be multiplied with a specific number that converts it to milliseconds.
Now when MB_DELAY is defined as MoneyBagDelay(0, 10, 0, 0)
it means that the timer should run every:
MoneyBagDelay(hour,min,sec,millisecond)
Which in your case it is:
0 hour,10 mins,0 seconds,0 milliseconds
And now, only 10 mins are converted to milliseconds, which means that the timer runs once every 10 mins.
|
thanks man , +REP