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
#2

Should be moved to tutorials, and change subject to: How to fix pawno compiler warnings & errors. (Most common errors/warnings).

Or just leave it like that, I see it fits a little bit in this section.

On-topic: Great! Well done.
Reply
#3

Well done. Will be a nice thing for people to read over who are new to pawn.
Reply
#4

Great !!!!!!
Reply
#5

Thanks for all the comments, i've restyled some things, if you find more errors/warnings please add them here, i'd like to add them.
Reply
#6

Warning 217 - loose indentation:

Caused by bad indentation.

Example:

pawn Код:
if( strcmp( cmdtext, "/test", true ))
                {
      MyFunctionHere;
 if( something == somethingElse )
      {      somethingMuchElse; }
                            return true;
                  }
How to fix: Indent.

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.

Example how to fix:
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
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
...
Added, thanks!
Reply
#8

No problem
Reply
#9

Added 4 new errors/warnings + bumb.
Also need some further explanation with warning 219.
Reply
#10

219 means you have a new variable defined that is defined at a preceding level.
For Example:
pawn Код:
new string[128];

public OnPlayerCommandText(playerid, cmdtext[])
{
     new string[128];
     if(!strcmp(cmdtext, "/msg", true))
     {
          format(string, sizeof(string), "%i", 42);
          SendClientMessage(playerid, COLOR_GREEN, string);
      }
}
or having it defined in 2 levels of a command or other fxn:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   new string[128];
   if(!strcmp(cmdtext, "/msg", true))
  {
     new string[128];
     format(string, sizeof(string).......... //You get the rest
Reply
#11

Wrong section - Maybe should have been posted in the Tuts section, But it is a great tut
Reply
#12

It's about time somebody created a thread like this! Nicely done.
Reply
#13

Quote:
Originally Posted by randomkid88
View Post
...
Thanks, has been added!
Reply
#14

Bumb, this has to be useful for everybody
Reply
#15

Code:
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\JunkBuster.inc(3240) : warning 201: redefinition of constant/macro (symbol "OnPlayerEnterRaceCheckpoint")
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeStrip.inc(27) : warning 219: local variable "panels" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeStrip.inc(27) : warning 219: local variable "doors" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeStrip.inc(27) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeStrip.inc(27) : warning 219: local variable "tires" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(3213) : error 001: expected token: "}", but found "-string-"
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(3214) : error 010: invalid function or declaration
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(12667) : warning 209: function "AddFlitsPaal" should return a value
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(15755) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(20307) : error 021: symbol already defined: "OnPlayerUpdate"
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(20312) : warning 213: tag mismatch
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(30359) : error 037: invalid string (possibly non-terminated string)
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(30359) : error 017: undefined symbol "CCF83C"
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(30359) : error 017: undefined symbol "Multumiri"
C:\Documents and Settings\Vero\Desktop\Betivii\gamemodes\greenzone.pwn(30359) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
how fix this ??
Reply
#16

I have an error: error 010: invalid function or declaration.Can you add it?Thanks!!
Reply
#17

Wow this is a BIG bump!

@alexandrusava93: Show the lines?
Reply
#18

no pawno

PHP Code:
new Mensagenscima[13][128] ={
    
"Aviso: Chame seus amigos para jogar aqui, vocк ajudarб o servidor a crescer !",
    
"Aviso: Nгo sabe quem й vip ou socio? /vips /socios!",
    
"Aviso: Novato ? Precisa de Ajuda ? USE: /relatorio",
    
"Aviso: Nгo tem nosso IP nos favoritos? IP:201.26.31.186:7777",
    
"Aviso: Nгo sabe nosso ID do RAIDCALL ? ID: 5401826",
    
"Aviso: Deseja mudar seu estilo de andar ? USE: /andar",
    
"Aviso: Estб perdido no meio do nada ? Use seu moderno /gps",
    
"Aviso: Seja VIP Armas Exclusivas e ajude-nos a crescer! /Forum",
    
"Aviso: Precisando de ajuda ? Digite /ajuda",
    
"Aviso: Nгo sabe nosso ID do RAIDCALL ? ID: 5401826",
    
"Aviso: Para ver os Advogados Online USE: /advogados",
    
"Aviso: Nгo tem nosso ID nos favoritos? IP:201.26.31.186:7777",
    
"Aviso: Visite Nosso Forum e compre sua vip :http://br-crazylife.forumeiros.com";

Quando copila

PHP Code:
C:\Users\Marcos\Desktop\MundoNovo.pwn(881) : error 001expected token"}"but found ";"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Reply
#19

Thank you!
Reply
#20

sorry but how to fix this i need help,
here i have some image: http://prntscr.com/4vteol and http://prntscr.com/4vtfb5

Quote:

C:\Users\krste\Desktop\Tomato RPG Macedonia\gamemodes\DreamTeam.pwn(4374) : warning 208: function with tag result used before definition, forcing reparse
C:\Users\krste\Desktop\Tomato RPG Macedonia\gamemodes\DreamTeam.pwn(4402) : warning 208: function with tag result used before definition, forcing reparse

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)