02.01.2011, 05:45
(
Последний раз редактировалось leong124; 02.01.2011 в 06:59.
)
Today I read the articles about timer that ****** wrote and I try to use the SetTimer function with delayed loading.
However, I got some questions and I made some testes:
and the first
won't work.
Both prints message2.
Seems that it's impossible to call the same function with different interval at the same time?
Also,I found that the string passed in SetTimerEx cannot be outputted directly. It must be formatted or it'll just print null string. What's the problem?
Sorry for my bad English but please help.
EDIT:
Now I found that only strings will act like that.
Passing integers will be normal.
See the testing code:
and it prints:
Weird...
However, I got some questions and I made some testes:
Код:
#include <a_samp> forward RunTimer(const funcname[]); public OnGameModeInit() { SetTimerEx("RunTimer",100,false,"s","message"); SetTimerEx("RunTimer",1000,false,"s","message2"); } public RunTimer(const funcname[]) { new string[128]; format(string,sizeof(string),"%s",funcname); print(string); printf("%s",funcname); print(funcname); return 1; }
Код:
SetTimerEx("RunTimer",100,false,"s","message");
Both prints message2.
Seems that it's impossible to call the same function with different interval at the same time?
Also,I found that the string passed in SetTimerEx cannot be outputted directly. It must be formatted or it'll just print null string. What's the problem?
Sorry for my bad English but please help.
EDIT:
Now I found that only strings will act like that.
Passing integers will be normal.
See the testing code:
Код:
#include <a_samp> forward RunTimer(num,string2[]); public OnGameModeInit() { SetTimerEx("RunTimer",1000,false,"ds",1,"abc"); SetTimerEx("RunTimer",1000,false,"ds",0,"def"); } public RunTimer(num,string2[]) { new string[128]; format(string,sizeof(string),"%d %s",num,string2); print(string); return 1; }
Код:
1 def 0 def