25.10.2018, 16:54
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.
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.
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.
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);
Код:
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 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.