SA-MP Forums Archive
Script Problem - 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: Script Problem (/showthread.php?tid=141996)



Script Problem - Daniel_Truk - 16.04.2010

Hello

When i add
pawn Код:
stock IsPlayerAiming(playerid, aimid)
{
    // Not my function, can't remember who made it though.
    new Float:X1, Float:Y1, Float:Z1, Float:X2, Float:Y2, Float:Z2;
    GetPlayerPos(playerid, X1, Y1, Z1);
    GetPlayerPos(aimid, X2, Y2, Z2);
    new Float:Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
    if(Distance < 100)
    {
        new Float:A;
        GetPlayerFacingAngle(playerid, A);
        X1 += (Distance * floatsin(-A, degrees));
        Y1 += (Distance * floatcos(-A, degrees));
        Distance = floatsqroot(floatpower(floatabs(X1-X2), 2) + floatpower(floatabs(Y1-Y2), 2));
        if(Distance < 0.5)
        {
          return true;
        }
    }
    return false;
}
I am getting this warning
warning 219: local variable "Distance" shadows a variable at a preceding level

/cake




Re: Script Problem - brett7 - 16.04.2010

check you havn't defined distance twice or more


Re: Script Problem - Daniel_Truk - 16.04.2010

twice more
new Float:distance = (sqxdist+sqydist)/31;
new Float:distance,value;


Re: Script Problem - brett7 - 16.04.2010

there the problem you have defined it twice


Re: Script Problem - Daniel_Truk - 16.04.2010

still same problem removed the other defines


Re: Script Problem - Daniel_Truk - 16.04.2010

its nothing about thats its defined twice


Re: Script Problem - Mikep. - 16.04.2010

Just change the name of the variable to something else..