Both of those lines are fine?
#1

I'm not sure what's wrong.

I don't know which line is the problem, Because sometimes the line it shows error is actually the line above it.

PHP код:
       new i=strfind(text,advword),j=i+strlen(advword)-1text[i++]='[';
       while(
j<j) {text[i]='•';i++} 
C:\Users\private\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(269) : error 001: expected token: ";", but found "}"
Reply
#2

Ok, first of all: j will always equal j, so j < j is not a valid expression.
Second, you missed a semi-colon right after i++ on the second line, within that while loop.
Reply
#3

Quote:
Originally Posted by HazardouS
Посмотреть сообщение
Ok, first of all: j will always equal j, so j < j is not a valid expression.
Second, you missed a semi-colon right after i++ on the second line, within that while loop.
so it's j == j ?

And i didn't really understand the second answer
Reply
#4

Your code looks like this, with a little coding style:
pawn Код:
new i = strfind(text, advword), j = i + strlen(advword)-1; //line 1
text[i++] = '[';                                                           //line 2
while(j<j)                                                                  //line 3
{                                                                              //line 4
    text[i] = '•';                                                           //line 5
    i++                                                                       //line 6
}                                                                              //line 7
Now that your code looks cleaner and it has lines, let's take a look at it.
Line 1 is fine.
Line 2 is fine.
Line 3:
- while (j < j) is like saying "while 1 < 1, do something". 1 will never be less than 1, they are equal.
- I think you wanted to say "while(i<j)"
Line 4 is fine.
Line 5 is fine.
Line 6:
- This is called incrementation, you are adding 1 to i.
- You forgot to add a semi-colon (the symbol ';') at the end of it.
Line 7 is fine.

The correct version:
pawn Код:
new i = strfind(text, advword), j = i + strlen(advword)-1;
text[i++] = '[';
while(i<j)
{
    text[i] = '•';
    i++;
}
Reply
#5

Quote:
Originally Posted by HazardouS
Посмотреть сообщение
Your code looks like this, with a little coding style:
pawn Код:
new i = strfind(text, advword), j = i + strlen(advword)-1; //line 1
text[i++] = '[';                                                           //line 2
while(j<j)                                                                  //line 3
{                                                                              //line 4
    text[i] = '•';                                                           //line 5
    i++                                                                       //line 6
}                                                                              //line 7
Now that your code looks cleaner and it has lines, let's take a look at it.
Line 1 is fine.
Line 2 is fine.
Line 3:
- while (j < j) is like saying "while 1 < 1, do something". 1 will never be less than 1, they are equal.
- I think you wanted to say "while(i<j)"
Line 4 is fine.
Line 5 is fine.
Line 6:
- This is called incrementation, you are adding 1 to i.
- You forgot to add a semi-colon (the symbol ';') at the end of it.
Line 7 is fine.

The correct version:
pawn Код:
new i = strfind(text, advword), j = i + strlen(advword)-1;
text[i++] = '[';
while(i<j)
{
    text[i] = '•';
    i++;
}
Thank you very much! - Repped +2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)