Need help with something
#1

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
Reply
#2

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

Reply
#3

How i can fix it ?
Reply
#4

Anybody? Please help
Reply
#5

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

Tyvm, It worked
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)