PAWN Error/Warning codes
#1

This is a list of meanings of all the error/warnings in PAWN, included some examples and fixes.
This page includes;

Quote:

- Error: 001 (
- Error: 017
- Error: 020
- Error: 021 NEW
- Error: 029
- Error: 032
- Error: 033
- Error: 035 NEW
- Error: 037 NEW
- Warning: 202
- Warning: 203
- Warning: 204 NEW
- Warning: 217
- Warning: 215 NEW
- Warning: 219 NEW
- Fatal Error: 107 NEW
If you find any other errors/warnings, please post it here and tell me how you got it, and fixed it.
* This page is "in-the-make" and can be updated anytime!


====================================>


* Error 001: expected token: "}", but found "["
- Used too many arrays inside an enum variable.

Example:
pawn Код:
enum testenum
{
    test[2][5],
};
new testvariable[testenum];
Fix:
pawn Код:
enum testenum
{
    test[2],
};
new testvariable[testenum];
===>

* Error 001: expected token: "}", but found "]"
- Found ] inside an enum variable.

Example:
pawn Код:
enum testenum
{
    test],
};
new testvariable[testenum];
Fix:
pawn Код:
enum testenum
{
    test,
};
new testvariable[testenum];
===>

* Error 001: expected token: ",", but found ";"
- A function has not been finished.

Example:
pawn Код:
test(0;
Fix:
pawn Код:
test(0);
===>

* Error 001: expected token: "]", but found ","
- There is no ] at the end of an enum variable.

Example:
pawn Код:
enum testenum
{
    test[2,
};
new testvariable[testenum];
Fix:
pawn Код:
enum testenum
{
    test[2],
};
new testvariable[testenum];
===>

* Error 001: expected token: "]", but found ";"
- There is no ] at the end of an array.

Example:
pawn Код:
new test[2;
Fix:
pawn Код:
new test[2];
===>

* Error 001: expected token: ";", but found "xxx.."
- Variable is using invalid symboles.

Example:
pawn Код:
new te?st;
Fix:
pawn Код:
new test;
===>

* Error 001: expected token: ";", but found "-identifier-"
- You forgot ";" after calling a function.

Example:
pawn Код:
test(0)
Fix:
pawn Код:
test(0);
===>

* Error 001: expected token: ";", but found "-integer value-"
- You forgot a [, ], or both while making an array.

Example:
pawn Код:
new test[2]5];
OR
pawn Код:
new test 2];
OR
pawn Код:
new test 2;
Fix:
pawn Код:
new test[2][5];
OR
pawn Код:
new test[2];

====================================>


* Error 017: undefined symbol "test"
- "test" has been used, but never created/defined.

Example:
pawn Код:
test = 1;
or
pawn Код:
Test();
Fix:
pawn Код:
new test;
test = 1;
OR
pawn Код:
Test();

Test()
{

}

====================================>


* Error 020: invalid symbol name ""
- Variable is using invalid symboles in front.

Example:
pawn Код:
new ?test;
Fix:
pawn Код:
new test;
====================================>


* Error 021: symbol already defined: "test"
- Variable has already been created.

Example:
pawn Код:
new test;
new test;
Fix:
pawn Код:
new test;

====================================>


* Error 029: invalid expression, assumed zero
- Variable or function is not completed.

Example:
pawn Код:
new test[;
OR
pawn Код:
test(;
OR
pawn Код:
test);
Fix:
pawn Код:
new test;
OR
pawn Код:
test();

====================================>


* Error 032: array index out of bounds (variable "test")
- A number in an array in "test" is above the created limit.

Example:
pawn Код:
new test[2];
test[3] = 5;
Fix:
pawn Код:
new test[2];
test[0] = 5;

====================================>


* Error 033: array must be indexed (variable "test")
- There is an array missing in "test".

Example:
pawn Код:
new test[2];
test = 5;
Fix:
pawn Код:
new test[2];
test[0] = 5;

====================================>


* Error 035: argument type mismatch (argument xxx)
- Wrong usage of a parameter in a function.

Example:
pawn Код:
SendClientMessage("playerid", 0x000000FF, "This is a test message!");
Fix:
pawn Код:
SendClientMessage(playerid, 0x000000FF, "This is a test message!");

====================================>


* Error 037: invalid string (possibly non-terminated string)
- The usage of a string is wrong (probably forgot a ").

Example:
pawn Код:
SendClientMessage(playerid, 0x000000FF, "This is a test message!);
Fix:
pawn Код:
SendClientMessage(playerid, 0x000000FF, "This is a test message!");
====================================>


* Warning 202: number of arguments does not match definition
- The called function has too less or too many parameters.

Example:
pawn Код:
test(2, 5, 7);
WHILE
pawn Код:
test(int1, int2)
{
    // stuff
}
Fix:
pawn Код:
test(2, 5);

====================================>


* Warning 203: symbol is never used: "test"
- "test" has been created/defined, but never used.

Example:
pawn Код:
new test;
OR
pawn Код:
testfunction(test)
{
    // stuff
}
Fix:
pawn Код:
new test;
test = 0;
OR
pawn Код:
testfunction()
{
    // stuff
}

====================================>


* Warning 204: symbol is assigned a value that is never used: "test"
- Variable has been created and set, but has no effect.

Example:
pawn Код:
new test;
test = 1;
Fix:
pawn Код:
new test;
test = 1;
if(test == 1)
{
// Etc..

====================================>


* Warning 215: expression has no effect
ATTENTION: Please fix any other errors first!
- Variable has been used but never created.

Example:
pawn Код:
test = 1;
Fix:
pawn Код:
new test;
test = 1;

====================================>


* Warning 217: loose indentation (Thanks to LarzI)
- Incorrect identation.

Example:
pawn Код:
if( strcmp( cmdtext, "/test", true ))
                {
      MyFunctionHere;
 if( something == somethingElse )
      {      somethingMuchElse; }
                            return true;
                  }
OR
pawn Код:
if( strcmp( cmdtext, "/test", true ))
{
MyFunctionHere;
if(something == somethingElse)
{
somethingMuchElse;
}
return true;
}
Fix:
Indentation is tabs in script.
First code starts at column 0 (or 1) which is 0 tabs.
If a sub-part of a code (after a opening bracket { or if statement generally) you put a tab.

pawn Код:
if( strcmp( cmdtext, "/test", true ))
{   //first part of code, no tabs
    MyFunctionHere; //pawn uses 4 spaces for one tab. This is after a opening bracket, therefore we enter one tab.
    if( something == somethingElse ) //here is another statement, but followed by a bracket, so the bracket won't be indented.
    {      
        somethingMuchElse; //this, on the other hand, is after a bracket, therefore we indent with another tab.
    } //the bracket is closed, therefore we go back to the column where the bracket is positioned (indented).
    return true; //still the same column, since there are no more opening-brackets, and no statements.
} //closing this part of code - go back to the first column

====================================>


* Warning 219: local variable "test" shadows a variable at a preceding level (Thanks to randomkid8
- A same named variable has been created at a preceding level.

Example:
pawn Код:
public TestFunction()
{
    new test;
    if(Example)
    {
        new test;
        test = 1;
    }
}
Fix:
pawn Код:
public TestFunction()
{
    new test;
    if(Example)
    {
        test = 1;
    }
}

====================================>


* Fatal error 107: too many error messages on one line
ATTENTION: Please fix any other errors first!
- There are too many errors.
Reply


Messages In This Thread
PAWN Error/Warning codes - by DVDK - 24.10.2010, 15:11
Re: PAWN Error/Warning codes - by ••• ĤБĶБM ••• - 24.10.2010, 15:17
Re: PAWN Error/Warning codes - by DarrenReeder - 24.10.2010, 15:26
Re: PAWN Error/Warning codes - by iJumbo - 24.10.2010, 15:40
Re: PAWN Error/Warning codes - by DVDK - 25.10.2010, 10:44
Re: PAWN Error/Warning codes - by LarzI - 25.10.2010, 11:55
Re: PAWN Error/Warning codes - by DVDK - 25.10.2010, 12:08
Re: PAWN Error/Warning codes - by LarzI - 25.10.2010, 12:31
Re: PAWN Error/Warning codes - by DVDK - 25.10.2010, 22:09
Re: PAWN Error/Warning codes - by randomkid88 - 26.10.2010, 01:54
Re: PAWN Error/Warning codes - by Luis- - 26.10.2010, 02:05
Re: PAWN Error/Warning codes - by Scenario - 26.10.2010, 02:16
Re: PAWN Error/Warning codes - by DVDK - 28.10.2010, 17:09
Re: PAWN Error/Warning codes - by DVDK - 02.12.2010, 21:18
Re: PAWN Error/Warning codes - by alexandrusava93 - 24.09.2012, 20:32
Re: PAWN Error/Warning codes - by stefanescu - 05.01.2013, 15:46
Re: PAWN Error/Warning codes - by Affan - 05.01.2013, 17:26
Re: PAWN Error/Warning codes - by marcos19952 - 07.01.2013, 15:38
Re: PAWN Error/Warning codes - by Onepind - 05.09.2014, 23:28
Re: PAWN Error/Warning codes - by krstecd - 13.10.2014, 16:42

Forum Jump:


Users browsing this thread: 1 Guest(s)