[HELP] About "for" (maybe all loops)
#1

First of all forgive me with making double topics when the last one is pretty much unsolved yet.

I tried using a loop with "for" and then put another code down there, but after the loop finishes the code below the loop sometimes can't be executed.

What I meant maybe is well-explained by an example :
pawn Код:
for(new i = 1; i <= 20; i++)
{
      // do something in here
}
SendClientMessage(playerid, WHITE, "asd");
Note that this is only an example.
With this code, the SendClientMessage won't be executed. Am I doing the loop wrong, or is there another reason why this happens often?
Thanks in advance.
Reply
#2

You tried to put this [pawn]SendClientMessage(playerid, WHITE, "asd");[/quote] above this "for"?
Reply
#3

it depends on what sort of code you use in the loop.
Reply
#4

Quote:
Originally Posted by LetsOWN[PL]
Посмотреть сообщение
You tried to put this [pawn]SendClientMessage(playerid, WHITE, "asd");above this "for"?
This is just an example. In my real code I used some ini system to load a few files containing a few similar datas needed for the code below, and it won't work sadly.

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
it depends on what sort of code you use in the loop.
Such as?
I'm actually using Double-O-Files inside the loop, how does it affect the loop?
Reply
#5

check if the array, in which you are saving data, is large enough to contain the values.
Reply
#6

You are most probably returning a value during that loop which is causing anything after it, not to be parsed.
Reply
#7

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
check if the array, in which you are saving data, is large enough to contain the values.
All of them are integers actually.

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
You are most probably returning a value during that loop which is causing anything after it, not to be parsed.
I'm not sure about this, though I did deleted return 1 and it still won't work.
DOF has also OnParseFile which I'm not using. Prefer using the same techniques as dini.
More explanation?
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
That's not what they asked - the fact that you are using "<=" rather than "<" leads me to believe this may well be the problem. Check your indexes.
Oh my goodness, this really solved all the problems!
Thanks so much everybody!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)