Both of those lines are fine? -
Glossy42O - 06.02.2015
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)-1; text[i++]='[';
while(j<j) {text[i]='•';i++}
C:\Users\private\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(269) : error 001: expected token: ";", but found "}"
Re: Both of those lines are fine? -
HazardouS - 06.02.2015
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.
Re: Both of those lines are fine? -
Glossy42O - 06.02.2015
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
Re: Both of those lines are fine? -
HazardouS - 06.02.2015
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++;
}
Re: Both of those lines are fine? -
Glossy42O - 06.02.2015
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