SA-MP Forums Archive
Local variable shadows a variable at a perceding 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 shadows a variable at a perceding level (/showthread.php?tid=648756)



Local variable shadows a variable at a perceding level - LI0LIKAS - 28.01.2018

Hey,

Why do I get these warnings?

Код:
warning 219: local variable "interior" shadows a variable at a preceding level
warning 219: local variable "interior" shadows a variable at a preceding level
warning 203: symbol is never used: "interior"
Code:

Код:
forward UnjailPlayer(playerid,Float:x,Float:y,Float:z,Float:a,interior);
public UnjailPlayer(playerid,Float:x,Float:y,Float:z,Float:a,interior)
{
	if(!playerDB[playerid][ikalintas]) return;
	SetPlayerPos(playerid,x,y,z);
	SetPlayerFacingAngle(playerid,a);
	SetPlayerInterior(playerid,interior);
	TogglePlayerControllable(playerid,true);
	SetPlayerWantedLevel(playerid,0);
	playerDB[playerid][ikalintas]=false;
	playerDB[playerid][kalejimo_laikas]=0;
}

stock JailPlayer(playerid,Float:x,Float:y,Float:z,Float:a,time,interior,Float:unX,Float:unY,Float:unZ,Float:unA,unInterior,bool:controlable)
{
	SetTimerEx("UnjailPlayer",time,0,"iffffi",playerid,unX,unY,unZ,unA,unInterior);
	SetPlayerInterior(playerid,interior);
	SetPlayerPos(playerid,x,y,z);
	SetPlayerFacingAngle(playerid,a);
	TogglePlayerControllable(playerid,controlable);
	SetPlayerWantedLevel(playerid,0);
	playerDB[playerid][ikalintas]=true;
}



Re: Local variable shadows a variable at a perceding level - edyun - 28.01.2018

You have the variable interior, somewhere else, try rename the "interior" variable from those 2 functions to something else, like interior1 for the first function and interior2 for the second one. They might even shadow one another.


Re: Local variable shadows a variable at a perceding level - LI0LIKAS - 28.01.2018

Fixed.
Thanks for help