Posts: 1,266
Threads: 6
Joined: Oct 2014
by won't work do you mean it never finishes? if yes, you've forgot i++ after the check ->
PHP код:
while(i < 2)
{
if(strlen(dmvInfo[i][dmvName]) > 0){
format(string, sizeof(string), "%s%d\t%s\t%s\t%s", string, dmvInfo[i][dmvID], dmvInfo[i][dmvName], dmvInfo[i][dmvAuthor], dmvInfo[i][dmvCreationDate]);
}
i++;
}
Posts: 1,046
Threads: 250
Joined: Nov 2014
Reputation:
0
By won't work I mean, the dialog won't show if I don't add break; under the format, inside the if statement...
and if I add break; the loop will stop at the first result, and I don't want it to stop at first result.
Posts: 1,266
Threads: 6
Joined: Oct 2014
Yea the dialog won't work because the loop will never stop as the i < 2 statement always true.
try my code and post result.
Posts: 1,266
Threads: 6
Joined: Oct 2014
Quote:
Originally Posted by frouzen
It's because you aren't giving i a number. Try this.
Код:
for(new i=0; i < 2; i++)
|
pawn isn't c#... if you don't assign value to a integer it will get value 0.
@AndreiWow are you sure the if statement is true? mind debugging? also you may wanna use sizeof ->
PHP код:
for(new i; i < sizeof dmvInfo; i++)
{
printf("Length of %d: %d",i, strlen(dmvInfo[i][dmvName]));
if(strlen(dmvInfo[i][dmvName]) > 0)
{
format(string, sizeof(string), "%s%d\t%s\t%s\t%s", string, dmvInfo[i][dmvID], dmvInfo[i][dmvName], dmvInfo[i][dmvAuthor], dmvInfo[i][dmvCreationDate]);
}
}