SA-MP Forums Archive
Tag mismatch - 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)
+--- Thread: Tag mismatch (/showthread.php?tid=559836)



Tag mismatch - Sime30 - 25.01.2015

Hi guys, I have some mismatches on codes I recently found on this website.

pawn Код:
NajblizaBenzinskaPumpa(playerid) // closest gas station
{
    new benzaid, Float:distance = 99999.0, Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    for(new i = 0; i <MAX_FIRMI; i++)
    {
        if(FirmaInfo[i][Vrsta] == 1)
        {
            new Float:tempdist;
            tempdist = GetDistanceBetween(x, y, z, FirmaInfo[i][EXTX], FirmaInfo[i][EXTY], FirmaInfo[i][EXTZ]); // I have 6 mismatches at this line
            if(tempdist < distance)
            {
                distance = tempdist;
                benzaid = i;
            }
        }
    }
    return benzaid;
}

GetDistanceBetween(x1, y1, z1, x2, y2, z2)
{
    new Float:dist;
    dist = floatsqroot(floatpower(floatsub(x2, x1), 2) + floatpower(floatsub( y2, y1), 2) + floatpower(floatsub( z2, z1), 2));
    return dist; // mismatch
}



Re: Tag mismatch - BroZeus - 25.01.2015

it should be
Quote:
Float:GetDistanceBetween(x1, y1, z1, x2, y2, z2)
{
new Float:dist;
dist = floatsqroot(floatpower(floatsub(x2, x1), 2) + floatpower(floatsub( y2, y1), 2) + floatpower(floatsub( z2, z1), 2));
return dist;
}




Re: Tag mismatch - Sime30 - 25.01.2015

Thank you BroZeus!

I am still getting mismatches at this line

pawn Код:
tempdist = GetDistanceBetween(x, y, z, FirmaInfo[i][EXTX], FirmaInfo[i][EXTY], FirmaInfo[i][EXTZ]);



Re: Tag mismatch - ATGOggy - 25.01.2015

Make "EXTX," where you defined it as "Float:EXTX", make it for EXTY and EXTZ too


Re: Tag mismatch - Sime30 - 25.01.2015

Already have it that way in enum...

pawn Код:
Float:EXTX,
Float:EXTY,
Float:EXTZ,



Re: Tag mismatch - Sime30 - 25.01.2015

Fixed mismatches!

Solution:

pawn Код:
forward Float:GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 );
public Float:GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
{
    new Float:dist;
    dist = floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) ;
    return dist;
}