Still can't find any problem in this 2 functions
#1

pawn Код:
stock GetClosestPlayer(playerid, Float:limit)
{
    new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2;
    GetPlayerPos(playerid, x1, y1, z1);
    new Float:Range = 999.9;
    new id = -1;
    foreach(Player,i)
    {
        if(playerid != i)
        {
            GetPlayerPos(i, x2, y2, z2);
            new Float:Dist = GetDistanceBetweenPoints(x1, y1, z1, x2, y2, z2);
            if(floatcmp(Range, Dist) == 1 && floatcmp(limit, Range) == 1)
            {
                Range = Dist;
                id = i;
            }
        }
    }
    return id;
}

stock Float:GetDistanceBetweenPoints(Float:rx1, Float:ry1, Float:rz1, Float:rx2, Float:ry2, Float:rz2)
{
    return floatadd(floatadd(floatsqroot(floatpower(floatsub(rx1,rx2),2)),floatsqroot(floatpower(floatsub(ry1,ry2),2))),floatsqroot(floatpower(floatsub(rz1,rz2),2)));
}
pawn Код:
function with tag result used before definition, forcing reparse
I get this warning on line stock:GetDistanceBetweenPoints..
Reply
#2

Check pawn-lang.pdf
Search there for the warning / error number, in your case 208

Quote:
Originally Posted by pawn-lang.pdf
208 - function with tag result used before definition

When a function is “used” (invoked) before being declared, and that function returns a value with a tag name, the parser must make an extra pass over the source code, because the presence of the tag name may change the interpretation of operators (in the presence of user-defined operators). You can speed up the parsing/compilation process by declaring the relevant functions before using them
Reply
#3

put stock:GetDistanceBetweenPoints function before functions in which you use it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)