Subtraction does not work?
#9

That function uses MapAndreas_FindZ_For2DCoord wrongly.

The Z coord in the MapAndreas function is passed by reference, not return value!
MapAndreas_FindZ_For2DCoord does not even consider the value passed to Z, because it is not relevant.

Код:
native MapAndreas_FindZ_For2DCoord(Float:X, Float:Y, &Float:Z);
Your function will not even return the correct Z in interior 0, it will return the return value of MapAndreas_FindZ_For2DCoord which is NOT the Z coord (it probably returns 0/1 for success/failure). It should even give you a tag mismatch warning since MapAndreas_FindZ_For2DCoord returns an integer value.

Код:
forward Float:MapAndreas_FindZ_For2DCoordEx(playerid, Float:X, Float:Y, Float:Z);
public Float:MapAndreas_FindZ_For2DCoordEx(playerid, Float:X, Float:Y, Float:Z)
{
    new Float:zi;
    if(GetPlayerInterior(playerid) > 0)
    {
        zi = Z-1.011;
    }
    else
    {
        MapAndreas_FindZ_For2DCoord(X, Y, zi); // The height will get passed to "zi".
    }
    return zi;
}
If this doesn't work for you, you either pass the wrong playerid or something else is wrong with your code.
If you replaced MapAndreas_FindZ_For2DCoord with MapAndreas_FindZ_For2DCoordEx you also need to get Z from the return value, as opposed to getting it from the referenced parameter.
Reply


Messages In This Thread
Subtraction does not work? - by alanhutch - 24.10.2018, 19:11
Re: Subtraction does not work? - by Infin1ty - 24.10.2018, 20:13
Re: Subtraction does not work? - by alanhutch - 24.10.2018, 23:11
Re: Subtraction does not work? - by ReD_HunTeR - 25.10.2018, 00:31
Re: Subtraction does not work? - by alanhutch - 25.10.2018, 08:00
Re: Subtraction does not work? - by Infin1ty - 25.10.2018, 09:29
Re: Subtraction does not work? - by alanhutch - 25.10.2018, 09:53
Re: Subtraction does not work? - by alanhutch - 25.10.2018, 13:37
Re: Subtraction does not work? - by NaS - 25.10.2018, 16:54
Re: Subtraction does not work? - by alanhutch - 26.10.2018, 11:51

Forum Jump:


Users browsing this thread: 1 Guest(s)