Comvert SAMP X,Y to Image Pixel
#1

Hi all,

i would like to know how can i convert samp pos to mi image pos.

My image is 3000*3000

I want ton place icons from gta into the image

Thank you

Max
Reply
#2

Well the San Andreas map is 6000*6000, so you should just calculate the half of the coordinate.
Reply
#3

Removed..
Reply
#4

Quote:
Originally Posted by TheDeadlyDutchi
Посмотреть сообщение
Well the San Andreas map is 6000*6000, so you should just calculate the half of the coordinate.
No,

it's like

XMin -2989.5361
XMax 2977.8582

YMin -2942.8245
YMax 2989.5361


Max
Reply
#5

The problem is to onvert it.

Because 0.0 beging into the left top in the image.

But samp coord 0.0 is into los santos.

Max
Reply
#6

Already did.

Doesn't work

Here is the small map it work, but i didn't remember how
http://wcrp.net/carte/maisons.php

here juste put samp coord

http://wcrp.net/carte/maisons3.php

here samp coord +3000

http://wcrp.net/carte/maisons2.php

As you wan see it doesn't work

Max
Reply
#7

like this?
Код:
MapIconPosX=(HousePosX+3000)/2;
MapIconPosY=3000-(HousePosY+3000)/2;
Reply
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
Looks like you've got the X or Y inverted.
I check one more time but no, the aren't inversed

Quote:
Originally Posted by Babul
Посмотреть сообщение
like this?
Код:
MapIconPosX=(HousePosX+3000)/2;
MapIconPosY=3000-(HousePosY+3000)/2;
and i got an pretty good result,

http://wcrp.net/carte/maisons3.php

I juste modify a bit, because samp max coord as i said i snot 3000 but +- 3000 ^^

Max
Reply
#9

edit: ah you got it working

old: hm... may we get 1 or 2 house coordinates? perhaps the 2 red houses at santa maria beach?
the position parameters are clear: -3000 to 3000 on both axis at the gta map, offset by 3000 to result in positive coords, scaled down /2 to fit the picture size, and the y-axis inverted. i clicked the link, and the houses in santos looks good... weird.
Reply
#10

Hi, sorry for possibly jacking your topic but, i've been wondering how to do this for a long time, would you or anyone else be able to help me? Thanks.

What I need is, basically, the same as the OP. I've used the code you provided Babul, but, I don't think it's work as it should! Here's what I currently have;
Код:
$Query = mysql_query("SELECT * FROM `houses`");
while($Row = mysql_fetch_assoc($Query)) {
	$MapIconPosX=($Row['out_X']+)/2;
	$MapIconPosY=3000-($Row['out_Y']+3000)/2;
	echo '<div style="z-index: 2;position:absolute;top:'.$MapIconPosY.';left:'.$MapIconPosX.'; width: 60px; height: 60px;"><img src="images/house-green.gif" /></div>';
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)