local variable "idx" 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: local variable "idx" shadows a variable at a preceding level (
/showthread.php?tid=439353)
local variable "idx" shadows a variable at a preceding level -
Stanford - 25.05.2013
So I compile it and I get a warning of:
pawn Код:
warning 219: local variable "idx" shadows a variable at a preceding level
pawn Код:
for(new idx=0; idx<MAX_DOORS; idx++) // Dynamic Doors
{
if(IsPlayerInRangeOfPoint(playerid, 2, DoorInfo[idx][dOX], DoorInfo[idx][dOY], DoorInfo[idx][dOZ]))
{
if(DoorInfo[idx][dIInt] == 83 && DoorInfo[idx][dIVW] == 8473 && BankBlock)
{
SendClientMessage(playerid, COLOR_GREY, "You can't enter the bank as it is being robbed at the moment.");
return 1;
}
if(DoorInfo[idx][dCInt])
{
GameTextForPlayer(playerid, "~w~Loading Objects", 3500, 3);
TogglePlayerControllable(playerid, 0);
SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
PlayerInfo[playerid][pSpawnFreeze] = 1;
}
PlayerInfo[playerid][pSpawnFreeze] = 0;
SetPlayerInterior(playerid, DoorInfo[idx][dIInt]);
SetPlayerVirtualWorld(playerid, DoorInfo[idx][dIVW]);
SetPlayerFacingAngle(playerid, DoorInfo[idx][dIA]);
SetCameraBehindPlayer(playerid);
SetPlayerPos(playerid, DoorInfo[idx][dIX], DoorInfo[idx][dIY], DoorInfo[idx][dIZ]);
return 1;
}
}
any help please?, thanks in advance.
Re: local variable "idx" shadows a variable at a preceding level -
DobbysGamertag - 25.05.2013
I'm guessing it's been declared, and used more than once in the same function. Change it's name for the paticluar place, and see if you get the same errors, something like idxA idxB etc