SA-MP Forums Archive
warning 219: local variable "i" shadows a variable at a preceding level - 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: warning 219: local variable "i" shadows a variable at a preceding level (/showthread.php?tid=605049)



warning 219: local variable "i" shadows a variable at a preceding level - Slawiii - 13.04.2016

how to fix this warning


code:
PHP Code:
foreach(Player,i) if(PlayerInfo[i][pAdmin] >= && i!= playerid && a_Level(i) >= a_Level(playerid)) SendClientMessage(i,COLOR_STEELBLUE,str2); 



Re: warning 219: local variable "i" shadows a variable at a preceding level - sampkinq - 13.04.2016

Try it this way.

Code:
foreach(Player,i) if(PlayerInfo[i][pAdmin] >= 1 && (i != playerid) && a_Level(i) >= a_Level(playerid)) SendClientMessage(i,COLOR_STEELBLUE,str2);
__

I'm sorry for my bad English.


Re: warning 219: local variable "i" shadows a variable at a preceding level - Konstantinos - 13.04.2016

"i" has been declared above. Simple, re-name "i" to some other name (such as "p") and also change the syntax to the newer one:
pawn Code:
foreach(new p : Player)



Re: warning 219: local variable "i" shadows a variable at a preceding level - Slawiii - 13.04.2016

Quote:
Originally Posted by Konstantinos
View Post
"i" has been declared above. Simple, re-name "i" to some other name (such as "p") and also change the syntax to the newer one:
pawn Code:
foreach(new p : Player)
yes thanks man SLOVED.