SetTimerEx problem -
leong124 - 02.01.2011
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:
Код:
#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;
}
and the first
Код:
SetTimerEx("RunTimer",100,false,"s","message");
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:
Код:
#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;
}
and it prints:
Weird...
Re: SetTimerEx problem -
Rachael - 02.01.2011
I have always had problems with strings in SetTimerEx, and also CallRemoteFunction
I solved the problem by not using strings in these functions.
A possible workaround is to use a string array, and pass the reference in the timer function. I used foreach and Iter_Add to ensure the array id is unique
Re: SetTimerEx problem -
leong124 - 02.01.2011
I also got problems on CallRemoteFunction before,
but the only problem is that it's unable to pass null strings but "\1\0".
You'll need to pass null like that and use isnull function to check it.
Re: SetTimerEx problem -
fangoth1 - 02.01.2011
i belive its
pawn Код:
SetTimerEx("blank here", time, false/true, "d", whatever here);
Re: SetTimerEx problem -
Mean - 02.01.2011
Quote:
Originally Posted by fangoth1
i belive its
pawn Код:
SetTimerEx("blank here", time, false/true, "d", whatever here);
|
Do you even know what does this d, i, s and all means?
Re: SetTimerEx problem -
_rAped - 02.01.2011
Quote:
Originally Posted by fangoth1
i belive its
pawn Код:
SetTimerEx("blank here", time, false/true, "d", whatever here);
|
D stands for integer, he's trying to print a string. Therefor `s`
Re: SetTimerEx problem -
leong124 - 03.01.2011
So any idea for why it acts like that?
Re: SetTimerEx problem -
AirKite - 11.06.2011
You must report
http://forum.sa-mp.com/forumdisplay.php?f=20