PDA

View Full Version : PAWN Error/Warning codes


DVDK
24/10/2010, 03:11 PM
This is a list of meanings of all the error/warnings in PAWN, included some examples and fixes.
This page includes;


- Error: 001 (8)
- 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:
enum testenum
{
test[2][5],
};
new testvariable[testenum];

Fix:
enum testenum
{
test[2],
};
new testvariable[testenum];

===>

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

Example:
enum testenum
{
test],
};
new testvariable[testenum];

Fix:
enum testenum
{
test,
};
new testvariable[testenum];

===>

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

Example:
test(0;

Fix:
test(0);

===>

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

Example:
enum testenum
{
test[2,
};
new testvariable[testenum];

Fix:
enum testenum
{
test[2],
};
new testvariable[testenum];

===>

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

Example:
new test[2;

Fix:
new test[2];

===>

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

Example:
new te?st;

Fix:
new test;

===>

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

Example:
test(0)

Fix:
test(0);

===>

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

Example:
new test[2]5];
OR
new test 2];
OR
new test 2;

Fix:
new test[2][5];
OR
new test[2];


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


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

Example:
test = 1;
or
Test();

Fix:
new test;
test = 1;
OR

Test();

Test()
{

}


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


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

Example:
new ?test;

Fix:
new test;

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


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

Example:
new test;
new test;

Fix:
new test;


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


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

Example:
new test[;
OR
test(;
OR
test);

Fix:
new test;
OR
test();


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


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

Example:
new test[2];
test[3] = 5;

Fix:
new test[2];
test[0] = 5;


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


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

Example:
new test[2];
test = 5;

Fix:
new test[2];
test[0] = 5;


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


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

Example:

SendClientMessage("playerid", 0x000000FF, "This is a test message!");


Fix:

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:

SendClientMessage(playerid, 0x000000FF, "This is a test message!);


Fix:

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:
test(2, 5, 7);
WHILE
test(int1, int2)
{
// stuff
}

Fix:
test(2, 5);


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


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

Example:
new test;
OR
testfunction(test)
{
// stuff
}

Fix:
new test;
test = 0;
OR
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:
new test;
test = 1;

Fix:
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:

test = 1;


Fix:

new test;
test = 1;



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


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

Example:
if( strcmp( cmdtext, "/test", true ))
{
MyFunctionHere;
if( something == somethingElse )
{ somethingMuchElse; }
return true;
}
OR
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.

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 randomkid88)
- A same named variable has been created at a preceding level.

Example:

public TestFunction()
{
new test;
if(Example)
{
new test;
test = 1;
}
}


Fix:
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.

••• ĤÁĶÁM •••
24/10/2010, 03:17 PM
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.

DarrenReeder
24/10/2010, 03:26 PM
Well done. Will be a nice thing for people to read over who are new to pawn.

iJumbo
24/10/2010, 03:40 PM
Great !!!!!!

DVDK
25/10/2010, 10:44 AM
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.

LarzI
25/10/2010, 11:55 AM
Warning 217 - loose indentation:

Caused by bad indentation.

Example:

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:
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

DVDK
25/10/2010, 12:08 PM
...

Added, thanks!

LarzI
25/10/2010, 12:31 PM
No problem :)

DVDK
25/10/2010, 10:09 PM
Added 4 new errors/warnings + bumb.
Also need some further explanation with warning 219.

randomkid88
26/10/2010, 01:54 AM
219 means you have a new variable defined that is defined at a preceding level.
For Example:

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:

public OnPlayerCommandText(playerid, cmdtext[])
{
new string[128];
if(!strcmp(cmdtext, "/msg", true))
{
new string[128];
format(string, sizeof(string).......... //You get the rest

Luis-
26/10/2010, 02:05 AM
Wrong section - Maybe should have been posted in the Tuts section, But it is a great tut :)

Scenario
26/10/2010, 02:16 AM
It's about time somebody created a thread like this! Nicely done. :D

DVDK
28/10/2010, 05:09 PM
...
Thanks, has been added!

DVDK
02/12/2010, 09:18 PM
Bumb, this has to be useful for everybody ;)

alexandrusava93
24/09/2012, 08:32 PM
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\JunkBu ster.inc(3240) : warning 201: redefinition of constant/macro (symbol "OnPlayerEnterRaceCheckpoint")
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeS trip.inc(27) : warning 219: local variable "panels" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeS trip.inc(27) : warning 219: local variable "doors" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeS trip.inc(27) : warning 219: local variable "lights" shadows a variable at a preceding level
C:\Documents and Settings\Vero\Desktop\Betivii\pawno\include\SpikeS trip.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 (c) 1997-2006, ITB CompuPhase


8 Errors.



how fix this ??

stefanescu
05/01/2013, 03:46 PM
I have an error: error 010: invalid function or declaration.Can you add it?Thanks!!

Affan
05/01/2013, 05:26 PM
Wow this is a BIG bump!

@alexandrusava93: Show the lines?

marcos19952
07/01/2013, 03:38 PM
no pawno

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

C:\Users\Marcos\Desktop\MundoNovo.pwn(881) : error 001: expected token: "}", but found ";"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Onepind
05/09/2014, 11:28 PM
Thank you! :D

krstecd
13/10/2014, 04:42 PM
sorry but how to fix this i need help,
here i have some image: http://prntscr.com/4vteol and http://prntscr.com/4vtfb5

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