Player Position Updating - 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: Player Position Updating (
/showthread.php?tid=312320)
Player Position Updating -
Scenario - 21.01.2012
I am trying to have a TD that will show a certain player some general stats around them. Some of which require me to obtain their position and display it on the TD (text-draw). I did this a little while ago using a 1 second timer that would call GetPlayerPos each time the timer was called (every second) and then update the TD- however that didn't seem to work very well.
Therefore, is there any other solution to do this? Or is there a better place for doing this? I would like for the position to update immediately, but I really don't want the server to lag. This will probably only happen for about 5 players at a time because only a select group has the ability to do this and there really won't be more than 5 people using it at the same time.
Anyways, please let me know. Also, could you explain how I could round the float value of their position to coordinates that would fit this?:
000.000
Re: Player Position Updating -
Babul - 21.01.2012
your described method sonds good. just rescript it
about the position value: i asume you want to format theplayers position (float) as a string, for displaying it properly in a textdraw. thats why you want leading zeros? hence the playerpositions are in the 1000's, not 100's. like
pawn Код:
format(string,sizeof(string),"PosX:%04.03f",X);
outputs a positon as "Pos:0000.000", where your 000.000 string matches the format "%03.03f"
Re: Player Position Updating -
Scenario - 21.01.2012
Quote:
Originally Posted by Babul
your described method sonds good. just rescript it
about the position value: i asume you want to format theplayers position (float) as a string, for displaying it properly in a textdraw. thats why you want leading zeros? hence the playerpositions are in the 1000's, not 100's. like
pawn Код:
format(string,sizeof(string),"PosX:%04.03f",X);
outputs a positon as "Pos:0000.000", where your 000.000 string matches the format "%03.03f"
|
Ah, thanks for the response. I re-scripted the system and threw it under OnPlayerUpdate just because I wanted to see for myself. Thanks for the information on formatting the float (yes, that's exactly what the leading zero's were for). Thanks again, Babul! I love you man (no homo)!