SA-MP Forums Archive
How do i fix these error and warnings ??!? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How do i fix these error and warnings ??!? (/showthread.php?tid=482547)



How do i fix these error and warnings ??!? - popche - 21.12.2013

Hello there i need help with my gamemod im putting in a property system buy it seems to be giving me an error and warnings i would be gratefull if you showed me how to solve them ?!

The error and the warnings:

Код:
E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7142) : warning 219: local variable "Distance" shadows a variable at a preceding level
E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7145) : error 022: must be lvalue (non-constant)
E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7146) : warning 213: tag mismatch
E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7146) : warning 206: redundant test: constant expression is non-zero
E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7142) : warning 203: symbol is never used: "Distance"
E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7232) : warning 219: local variable "CP" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Here is the pawn code from line 7139 to 7152:

PHP код:
7139forward IsPlayerNearProperty(playerid);
7140: public IsPlayerNearProperty(playerid)
7141: {
7142:     new Float:Distance;
7143:     for(new propprop<PropertiesAmountprop++)
7144:     {
7145:         Distance GetDistanceToProperty(playeridprop);
7146:         if(Distance 1.0)
7147:         {
7148:             return prop;
7149:         }
7150:     }
7151:     return -1;
7152: } 
I don't know how to solve these please help!


Re: How do i fix these error and warnings ??!? - Tayab - 21.12.2013

Try this.

and the variable defined in line 7232, change it to CPX

What it means is that CP is already defined in other areas of script.
pawn Код:
7139: forward IsPlayerNearProperty(playerid);
7140: public IsPlayerNearProperty(playerid)
7141: {
7142:     new Float:DistanceX;
7143:     for(new prop; prop<PropertiesAmount; prop++)
7144:     {
7145:         DistanceX = GetDistanceToProperty(playerid, prop);
7146:         if(DistanceX < 1.0)
7147:         {
7148:             return prop;
7149:         }
7150:     }
7151:     return -1;
7152: }



Re: How do i fix these error and warnings ??!? - popche - 21.12.2013

What is that CPX ?


Re: How do i fix these error and warnings ??!? - popche - 21.12.2013

I get this warning now:

Quote:

E:\SAMP\SAMP\VirtualWorld RPG Macedonia v1.0\gamemodes\VIRTUALWORLD.pwn(7232) : warning 219: local variable "CP" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size: 13044 bytes
Code size: 1611380 bytes
Data size: 4931096 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 6571904 bytes

1 Warning.

How do i fix this ?

sorry for spam