SA-MP Forums Archive
Above sea level meter? - 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: Above sea level meter? (/showthread.php?tid=302586)



Above sea level meter? - McCarthy - 09.12.2011

Well I'm currently scripting some gauges for aircrafts and I wanted to know how could I make a above sea level gauge in metres, I can make the textdraw myself but I need some function to get it


Re: Above sea level meter? - iTorran - 09.12.2011

pawn Код:
new Float:x, Float:y, Float:z, height[20];
GetPlayerPos(playerid, x, y, z);
format(height, sizeof height, "Height: %i", z);
SendClientMessage(playerid, 0xFFFFFFFF, height);
Just an example


Re: Above sea level meter? - MadeMan - 09.12.2011

It's the Z parameter of GetVehiclePos.


Re : Above sea level meter? - gagnier91 - 09.12.2011

plus, when you are in the sea, the z parameter is equal to zero, so you dont need math


Re: Above sea level meter? - Wezley_Sherman - 10.12.2011

But If I were you I would make it a text draw instead of a client message...


Re: Above sea level meter? - McCarthy - 10.12.2011


Seems like a quite weird number...no?
Heres my current code
pawn Код:
new Float:x, Float:y, Float:z;
GetVehiclePos(vid, x, y, z);
new string[128];format(string,sizeof string,"ASL: %d m",z);
TextDrawSetString(td_asl[i],string);



Re: Above sea level meter? - THE_KNOWN - 10.12.2011

its float not int


Re: Above sea level meter? - MadeMan - 10.12.2011

pawn Код:
format(string,sizeof string,"ASL: %.2f m",z);



Re: Above sea level meter? - McCarthy - 10.12.2011

Yeah nevermind used the wrong format string accidently, fixed