Player Position Updating
#1

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
Reply
#2

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"
Reply
#3

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)!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)