an issue with (SetTimer)
#1

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
Reply
#2

PHP код:
SetTimer("funcname"intervalrepeating); 
Reply
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
SetTimer("funcname"intervalrepeating); 
i know i searched samp wiki , but it doesnt look like it in this case
Reply
#4

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.
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)