SA-MP Forums Archive
Help me pls! - 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: Help me pls! (/showthread.php?tid=155634)



Help me pls! - duteba - 19.06.2010

I have 6 warnings,and i don't know how to repair it... help pls

Quote:

C:\Documents and Settings\C&A\Desktop\Servers\X-Zone Samp\pawno\include\morphinc.inc(5) : warning 219: local variable "x" shadows a variable at a preceding level
C:\Documents and Settings\C&A\Desktop\Servers\X-Zone Samp\pawno\include\morphinc.inc(5) : warning 219: local variable "y" shadows a variable at a preceding level
C:\Documents and Settings\C&A\Desktop\Servers\X-Zone Samp\pawno\include\morphinc.inc(5) : warning 219: local variable "z" shadows a variable at a preceding level
C:\Documents and Settings\C&A\Desktop\Servers\X-Zone Samp\gamemodes\gf_ro2.4.5.pwn(28843) : warning 219: local variable "x" shadows a variable at a preceding level
C:\Documents and Settings\C&A\Desktop\Servers\X-Zone Samp\gamemodes\gf_ro2.4.5.pwn(28843) : warning 219: local variable "y" shadows a variable at a preceding level
C:\Documents and Settings\C&A\Desktop\Servers\X-Zone Samp\gamemodes\gf_ro2.4.5.pwn(28843) : warning 219: local variable "z" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Warnings.




Re: Help me pls! - DJDhan - 19.06.2010

Rename the variables to anything else. You have created new variables with the same name in the same function three times.
Please show the code if that's not the problem.


Re: Help me pls! - duteba - 19.06.2010

Quote:

new pdistance = 1;
forward NameTimer();
Float:GetPointDistanceToPointExMorph(Float1,Floa t:y1,Float:z1,Float2,Float:y2,Float:z2)
{
new Float, Float:y, Float:z;
x = x1-x2;
y = y1-y2;
z = z1-z2;
return floatsqroot(x*x+y*y+z*z);
}
stock SetPDistance(dista)
{
pdistance = dista;
}
stock GetPDistance()
{
return pdistance;
}
stock EnableDistancedNameTag(delay)
{
SetTimer("NameTimer",delay,1);
}
forward NameTimer();
public NameTimer()
{
for(new i = 0;i < MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
for(new q = 0;q < MAX_PLAYERS;q++)
{
if(IsPlayerConnected(q))
{
new Float1x;
new Float1y;
new Float1z;
new Float2x;
new Float2y;
new Float2z;
if(IsPlayerConnected(i) && IsPlayerConnected(q))
{
GetPlayerPos(i,p1x,p1y,p1z);
GetPlayerPos(q,p2x,p2y,p2z);
if(GetPointDistanceToPointExMorph(p1x,p1y,p1z,p2x, p2y,p2z) < pdistance)
{
ShowPlayerNameTagForPlayer(i,q,1);
}
else
{
ShowPlayerNameTagForPlayer(i,q,0);
}
}}}}}
}

Quote:

public PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Floatldposx, Floatldposy, Floatldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}