One new string[] for all script.
#4

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
It will be buggy at some instances, for example if u do something like this :
pawn Код:
SomeFunc(playerid) // lets say it is called at 01:25:00
{
format(string, sizeof(string), "something something");
for(new i = 0; i < 1000;i++)//lets say it takes 4 sec to complete this loop
SendClinetMessage(playerid, -1, string); // executed at 01:25:04 caz loops take 4sec
return 1;
}

SomeOtherFunc()// lets say it is called at 01:25:02
{
format(string, sizeof(string), "bla bla bla");
WriteFile("somefile.txt", string); // some imaginary function, clear with its name what it does
return 1;
}
So now SendClientMessage will send "bla bla bla" instead of what it was suppose to send
So don't do this, people don't create new strings at every function just for like that.
Ya you need to reset the string any time you use it.

Код:
mystring[0] = '\0';
Or something like this to make it easier to understand with something like

Код:
#define ResetString(%0) %0[0] = '\0'
Reply


Messages In This Thread
One new string[] for all script. - by mike_1 - 29.12.2014, 13:18
Re: One new string[] for all script. - by MrCallum - 29.12.2014, 13:22
Re: One new string[] for all script. - by BroZeus - 29.12.2014, 13:26
Re: One new string[] for all script. - by Pottus - 29.12.2014, 13:31
Re: One new string[] for all script. - by mike_1 - 29.12.2014, 13:32
Re: One new string[] for all script. - by BroZeus - 29.12.2014, 13:38
Re: One new string[] for all script. - by mike_1 - 29.12.2014, 13:43
Re: One new string[] for all script. - by BroZeus - 29.12.2014, 13:47
Re: One new string[] for all script. - by mike_1 - 29.12.2014, 13:52
Re: One new string[] for all script. - by mike_1 - 29.12.2014, 14:53

Forum Jump:


Users browsing this thread: 1 Guest(s)