PDA

View Full Version : warning 219: local variable "i" shadows a variable at a preceding level


Slawiii
13/04/2016, 06:36 PM
how to fix this warning


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

sampkinq
13/04/2016, 06:58 PM
Try it this way.

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.

Konstantinos
13/04/2016, 07:01 PM
"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:

foreach(new p : Player)

Slawiii
13/04/2016, 07:06 PM
"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:

foreach(new p : Player)


yes thanks man SLOVED.