SA-MP Forums Archive
Ultimate idea for getting all gta Z coords - 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: Ultimate idea for getting all gta Z coords (/showthread.php?tid=68565)



Ultimate idea for getting all gta Z coords - lesley - 11.03.2009

I got that idea a few minutes ago...

You know that: You are trying to make a script that creates explosions on the floor of the position you are at, but you dont know how to get the ground Z coordinate.

I wanted to do it something like that:

A timer, refresh rate 500ms or something,
a variable which contains the current X/Y coordinates,
a variable which can be 0, 1 or 2...

If the variable is 0: SetPlayerPosFindZ to the current X/Y coordinate you want to have, set variable to 1.
If the variable is 1: SetPlayerPosFindZ again, because it doesnt work correctly if you run it 1 time (I fell into the water), set variable to 2.
If the variable is 2: GetPlayerPos and save the coordinates to a file, or SQL database, and do step 0 again with X/Y +/- 1...

Do you think that would actually work? I really think so, but it would just be good if you are AFK or at school or something, i can image it would take some hours/days.


... lesley


Re: Ultimate idea for getting all gta Z coords - lesley - 11.03.2009

Heheh lol, i made a working script which gets all Z coords, i tested it with a 60x60 square, took some minutes but maybe you could make a faster timer, i used 500ms.


Re: Ultimate idea for getting all gta Z coords - JaYmE - 11.03.2009

what where your results ?


Re: Ultimate idea for getting all gta Z coords - lesley - 11.03.2009

Quote:
Originally Posted by JaYmE
what where your results ?
http://pastebin.com/f1b846634

That one is a 30x30 one, because I added the time calculation thing and didnt want to have 60x60..


Re: Ultimate idea for getting all gta Z coords - Finn - 11.03.2009

I think it'll take damn long time to search the correct position from the very large file.


Re: Ultimate idea for getting all gta Z coords - lesley - 11.03.2009

Quote:
Originally Posted by Finn
I think it'll take damn long time to search the correct position from the very large file.
Thats why i mentioned SQL.


Re: Ultimate idea for getting all gta Z coords - JaYmE - 11.03.2009

yesh, but squery'ing a db with that many things in it would be bad, plus some of the floats are the same so you would most likly get the wrong cords ?


Re: Ultimate idea for getting all gta Z coords - lesley - 11.03.2009

SELECT posZ FROM coords WHERE posX = '%d' AND posY = '%d'

The only thing i still need is how to convert ingame x/y like 36.1521 to 35.0 (rounding to a number with 5 or 0 at the end)

Can somebody give me an example of how to do this..?


Re: Ultimate idea for getting all gta Z coords - Finn - 11.03.2009

Search for floatround().