SA-MP Forums Archive
Need help with something - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with something (/showthread.php?tid=81649)



Need help with something - kevin13 - 12.06.2009

C:\Users\-\Desktop\pawno\gamemodes\SoLSv2.pwn(43971) : warning 219: local variable "Distance" shadows a variable at a preceding level

What does that mean?

Line 43971:
new Floatistance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);

Line 43964 - 43978:
stock CheckPlayerDistanceToVehicle(Float:radi, playerid, vehicleid)
{
if(IsPlayerConnected(playerid))
{
new Float:PX,Float:PY,Float:PZ,Float:X,Float:Y,Float:Z ;
GetPlayerPos(playerid,PX,PY,PZ);
GetVehiclePos(vehicleid, X,Y,Z);
new Floatistance = (X-PX)*(X-PX)+(Y-PY)*(Y-PY)+(Z-PZ)*(Z-PZ);
if(Distance <= radi*radi)
{
return 1;
}
}
return 0;
}

How can i fix this? Please help


Re: Need help with something - efeX - 12.06.2009

That means you already have a variable called Distance defined before you defined it again..




Re: Need help with something - kevin13 - 12.06.2009

How i can fix it ?


Re: Need help with something - kevin13 - 13.06.2009

Anybody? Please help


Re: Need help with something - dice7 - 13.06.2009

you change the variable name 'Distance' to 'Distance2' in that code


Re: Need help with something - kevin13 - 13.06.2009

Tyvm, It worked