SA-MP Forums Archive
MySQL Coordinates issue - 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: MySQL Coordinates issue (/showthread.php?tid=650928)



MySQL Coordinates issue - C5Perfect - 10.03.2018

My house system is a bit buggy because the X,Y,Z coordinates don't save properly in MySQL field..
0 at the end is being deleted, sometimes last two digits..
I have tried using FLOAT or DOUBLE, nothing works

Any help would be appreciated


Re: MySQL Coordinates issue - KayJ - 10.03.2018

"Am I supposed to guess your code?"


Re: MySQL Coordinates issue - C5Perfect - 10.03.2018

Quote:
Originally Posted by KayJ
Посмотреть сообщение
"Am I supposed to guess your code?"
It's not the problem in code i think
If I manually enter "6404.930664" in MySQL field, it becomes "6404.93"


Re: MySQL Coordinates issue - Treyvan - 10.03.2018

It is saving properly, its rounding the decimal numbers.


Re: MySQL Coordinates issue - C5Perfect - 10.03.2018

Quote:
Originally Posted by Treyvan
Посмотреть сообщение
It is saving properly, its rounding the decimal numbers.
But when I load the house, it's not in the right place, it moves away and down a bit


Re: MySQL Coordinates issue - Sew_Sumi - 10.03.2018

You probably need to specify to what length the decimals go in the MySQL field itself.

You will need to submit some code anyway, as we need to check the storage/obtaining of the coords.

Could be an idea to show some of the settings for that field in the DB.


Re: MySQL Coordinates issue - Treyvan - 10.03.2018

Well its not the script causing it, its mySQL.

If you need the coordinates to be that exact change the field type on the x y z rows on the table to decimal, and be sure to set the decimal length to match what your looking for, you can also try changing the decimal value while the table is set to float it may give the same result. I haven't tried this on my server because I didn't see it as a problem lol.

Anyway for more information on this issue you can check the mysql manual article here for this issue. It may not be your sql version but it does try to help you understand whats going on.


Re: MySQL Coordinates issue - Sew_Sumi - 10.03.2018

^^ Yea, this is the sort of thing I was hinting towards.


Re: MySQL Coordinates issue - C5Perfect - 10.03.2018

If I change it to decimal, then it doesn't support dot so it could only be 6404 instead of 6404.930664 although I increased the length to match it.. Changing decimal value while table is set to float seems not to be possible

It is not my MySQL version for sure, I tried different one already

Yeah, I need exact coordinates because it's a house position heh


Re: MySQL Coordinates issue - C5Perfect - 14.03.2018

bump