SA-MP Forums Archive
show altitude in feet instead of meters? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: show altitude in feet instead of meters? (/showthread.php?tid=191818)



show altitude in feet instead of meters? - The_Gangstas - 20.11.2010

topic^? (8Char)


Re: show altitude in feet instead of meters? - [DM]Kane - 20.11.2010

1 meter = 3.2808399 feet
Just multiply the altitude by 3.2808399 to get it in feet


Re: show altitude in feet instead of meters? - The_Gangstas - 20.11.2010

huh example please?


Re: show altitude in feet instead of meters? - The_Gangstas - 20.11.2010

llike this?
pawn Код:
if(floatround(Z)) > 0)
                {
                    Z2=Z*3.2808399;
                }
sorry for double post.. accidentally didnt edit


Re: show altitude in feet instead of meters? - Austin - 20.11.2010

Try...

pawn Код:
Z2=floatround(floatmul(Z, 3.2808399));
... maybe.


Re: show altitude in feet instead of meters? - bigcomfycouch - 20.11.2010

pawn Код:
#define METRES_TO_FEET(%0) \
    ( ( %0 ) / 0.3047999995367040007042099189296 )
new
    altitude = floatround( METRES_TO_FEET( 500 ) );



Re: show altitude in feet instead of meters? - The_Gangstas - 20.11.2010

doesnt work

both shows 0 all the time


Re: show altitude in feet instead of meters? - bigcomfycouch - 20.11.2010

It worked fine for me in this test, not to mention I use that in my script for altitude as well.

http://pastebin.com/D4RAJj6X


Re: show altitude in feet instead of meters? - The_Gangstas - 20.11.2010

did i use it wrong?

pawn Код:
new altitude = floatround( METRES_TO_FEET( Z) );
                format(String,sizeof(String)," ~r~Vehicle~g~:~w~%s ~r~Health~g~:~w~%d%% ~r~MPH~g~:~w~%i ~r~KMH~g~:~w~%i ~r~Altitude~g~:~w~%d ft",aVehicleNames[GetVehicleModel(vehicle)-400],floatround(health,floatround_round), floatround(floatdiv(Speed, 1.609344), floatround_floor), floatround(Speed, floatround_floor),altitude);



Re: show altitude in feet instead of meters? - bigcomfycouch - 20.11.2010

I use it something like this

pawn Код:
new
    Float:vx,
    Float:vy,
    Float:vz;
GetVehiclePos( vehicle, vx, vy, vz );
format( String, sizeof ( String ), " ~r~Vehicle~g~:~w~%s ~r~Health~g~:~w~%i%% ~r~MPH~g~:~w~%i ~r~KMH~g~:~w~%i ~r~Altitude~g~:~w~%i ft", aVehicleNames[ GetVehicleModel( vehicle ) - 400 ], floatround( health, floatround_round ), floatround( floatdiv( Speed, 1.609344 ), floatround_floor ), floatround( Speed, floatround_floor ), floatround ( METRES_TO_FEET( vz ) ) );