04.08.2011, 10:53
(
Последний раз редактировалось Jochemd; 17.08.2012 в 07:24.
Причина: Added "Unknown parameter in substitution" 04/02/2012
)
Warning and Error List
by Jochemd
Warnings
Warnings
- Loose Indentation
- Cause: You got an unindented script
pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
SendClientMessage(playerid,-1,"You have left a checkpoint.");
print("Someone left a checkpoint");
return 1;
}
- Fix: Make sure your script is idented
pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
{
SendClientMessage(playerid,-1,"You have left a checkpoint.");
print("Someone left a checkpoint");
return 1;
}
- Cause: The part of the script the compiler says isn't reachable in any way; the script is returned before it reaches there.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == 520) // Just a random ID, unsure if it really exists
{
SendClientMessage(playerid,-1,"You have entered vehicle ID 520.");
return 1;
}
else return 0;
return 1;
}
- Fix: Make sure the code can be reached. It shouldn't be fully returned.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == 520) // Just a random ID, unsure if it really exists
{
SendClientMessage(playerid,-1,"You have entered vehicle ID 520.");
return 1
}
return 1;
}
- Cause: A very unimportant warning. You have commented something into a comment.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
/* if(vehicleid == 520)
{
if(playerid == 0)
{
/* if(ispassenger)
{
print("Ohai!");
return 1;
}
}
} */
return 1;
}
- Fix: Simply remove the second comment
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
/* if(vehicleid == 520)
{
if(playerid == 0)
{
if(ispassenger)
{
print("Ohai!");
return 1;
}
}
} */
return 1;
}
- Cause: You got more or less arguments (couldn't say it in another way) than you actually got to have.
pawn Код:
CMD:centermap(playerid,params[])
{
#pragma unused params
SetPlayerPos(playerid,0.0,0.0,3.0,90.0); // We've put the angle here too 'by accident'
SendClientMessage(playerid,-1,"You have been sent to the center of the map in Blue Berry.");
return 1;
}
- Fix: Look for the correct syntaxes for the function. SA-MP Wiki says SetPlayerPos only has 4 arguments; playerid, X, Y and Z. This means the angle shouldn't be in there
pawn Код:
CMD:centermap(playerid,params[])
{
#pragma unused params
SetPlayerPos(playerid,0.0,0.0,3.0);
SetPlayerFacingAngle(playerid,90.0); // Correct is to put the angle into this function.
SendClientMessage(playerid,-1,"You have been sent to the center of the map in Blue Berry.");
return 1;
}
- Cause: You've created a new array, but used it nowhere.
pawn Код:
CMD:skydive(playerid,params[])
{
#pragma unused params
new Float:Pos[3],string[128];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2] + 200);
SendClientMessage(playerid,-1,"You have been sent high in the sky.");
GivePlayerWeapon(playerid,46,1);
return 1;
}
- Fix: Simply remove the array, which fixes it most of the times.
pawn Код:
CMD:skydive(playerid,params[])
{
#pragma unused params
new Float:Pos[3];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
SetPlayerPos(playerid,Pos[0],Pos[1],Pos[2] + 200);
SendClientMessage(playerid,-1,"You have been sent high in the sky.");
GivePlayerWeapon(playerid,46,1);
return 1;
}
- Cause: You've assigned the wrong label to an array.
pawn Код:
CMD:mypos(playerid,params[])
{
#pragma unused params
new Pos[3]; // As you see the Pos array doesn't have the 'Float' label
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
printf("Your position: X: %f || Y: %f || Z: %f",Pos[0],Pos[1],Pos[2]);
return 1;
}
- Fix: Find the right label; in case of TextDraws ':Text', in case of 3D labels ':Text3D', and more.
pawn Код:
CMD:mypos(playerid,params[])
{
#pragma unused params
new Float:Pos[3]; // Now it has the label, it is all right.
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
printf("Your position: X: %f || Y: %f || Z: %f",Pos[0],Pos[1],Pos[2]);
return 1;
}
- Cause: You've used a parameter in a define which is unknown.
pawn Код:
#define PutPos(%1,%2,%3,%4); SetPlayerPos(%9,%2,%3,%4); // %9 is not defined here.
- Fix: Use the right parameters, and make sure they're defined before.
pawn Код:
#define PutPos(%1,%2,%3,%4); SetPlayerPos(%1,%2,%3,%4);
Errors
- Undefined symbol 'symbol'- Cause: The opposite of 'symbol is never used'. You are using a symbol somewhere which you haven't created.
pawn Код:
CMD:myname(playerid,params[])
{
#pragma unused params
GetPlayerName(playerid,Playername,sizeof(Playername));
SendClientMessage(playerid,-1,Playername);
return 1;
}
- Fix: Create the array you're using.
pawn Код:
CMD:myname(playerid,params[])
{
#pragma unused params
new Playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,Playername,sizeof(Playername));
SendClientMessage(playerid,-1,Playername);
return 1;
}
- Cause: You've created a symbol twice.
pawn Код:
CMD:myname(playerid,params[])
{
new Playername[MAX_PLAYER_NAME];
#pragma unused params
new Playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,Playername,sizeof(Playername));
SendClientMessage(playerid,-1,Playername);
return 1;
}
- Fix: Remove one of the two symbols you made.
pawn Код:
CMD:myname(playerid,params[])
{
#pragma unused params
new Playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,Playername,sizeof(Playername));
SendClientMessage(playerid,-1,Playername);
return 1;
}
- Cause: Not sure about this one. I think it's caused by invalid symbols on places where they shouldn't be.
pawn Код:
CMD:parachute(playerid,params[])
{
#pragma unused params
GivePlayerWeapon(playerid,46,1);k
SendClientMessage(playerid,-1,"You got a parachute");
return 1;
}
- Fix: Just remove that k.
pawn Код:
CMD:parachute(playerid,params[])
{
#pragma unused params
GivePlayerWeapon(playerid,46,1);
SendClientMessage(playerid,-1,"You got a parachute");
return 1;
}
- Cause: You got double tokens, such as ;;.
pawn Код:
CMD:parachute(playerid,params[])
{
#pragma unused params
GivePlayerWeapon(playerid,46,1);; // This will give empty statement
SendClientMessage(playerid,-1,"You got a parachute");
return 1;
}
- Fix: Find the double letter and remove it.
pawn Код:
CMD:parachute(playerid,params[])
{
#pragma unused params
GivePlayerWeapon(playerid,46,1); // This will give no errors.
SendClientMessage(playerid,-1,"You got a parachute");
return 1;
}
- First cause: You've used a function which isn't known by the compiler.
- Second cause: If you get 26 errors, while a couple of them are this error, you've forgot to close a function with a bracket.
pawn Код:
CMD:stats(playerid,params[])
{
SendFormatMessage(playerid,-1,"Cash: %d ... Score: %d",GetPlayerMoney(playerid),GetPlayerScore(playerid)); // We haven't added the stock in the function
return 1;
}
- First fix: Add the missing function in the script.
- Second fix: Find the missing bracket and add it.
pawn Код:
new str[128];
#define SendFormatMessage(%0,%1,%2,%3) format(str, sizeof(str),%2,%3) && SendClientMessage(%0, %1, str)
- Cause:You have put on top of script '#include <file>' but the file does not exist in the folder '/pawno/includes'.
- Fix: Put the file in the includes folder of pawno or remove the include line. This may cause problems with your script, so it's better to use the first solution.
Suggestions can be PMed to me.
Quote:
Originally Posted by Unsure Error List
|
Hope this will help much people,
Jochem