Showing altitude in meters
#1

I have this code to show altitude, but it shows veery long numbers, sometimes it shows negavite values, and i dont know how to make it show the Z (or altitude) in meters :
Код:
if(GetVehicleModel(plane) == 476)
	{
	GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
	format(alt_string,256,"Altitude: %i meters",speed_z);
	TextDrawSetString(altitude[playerid], alt_string);
	}
	else
	{
		TextDrawSetString(altitude[playerid], " ");
	}
Do i need to divide it by a specific value ?
Reply
#2

pawn Код:
if(GetVehicleModel(plane) == 476)
    {
    GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
    format(alt_string,256,"Altitude: %0.2f meters",speed_z);
    TextDrawSetString(altitude[playerid], alt_string);
    }
    else
    {
        TextDrawSetString(altitude[playerid], " ");
    }
updated your snippet.
I think %i was showing the many digits.
Making it to 0.2f can reduce it.
Reply
#3

Okay, but now it shows 0.13 meters when im up more like 30 meters
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)