Guest Posted February 6, 2008 Posted February 6, 2008 I suck at math. I've been trying to make a player blip map like on AlienX's server, but the math boggles my mind. How can I convert a player position to a pixel position on a map image? Or better yet, does anyone know where I can find AlienX's map resource, or something similar? Thanks.
50p Posted February 6, 2008 Posted February 6, 2008 Or better yet, does anyone know where I can find AlienX's map resource, or something similar? There is a formula which gives you the value for the "world" position. If nobody will give you that in time I won't be here I'll post it in the evening (I'm going to work now).
szlend Posted February 6, 2008 Posted February 6, 2008 I suggest analizing this script: viewtopic.php?f=91&t=21256
Guest Posted February 6, 2008 Posted February 6, 2008 I suggest analizing this script: viewtopic.php?f=91&t=21256 I'm using this in my script, and it's the map that the blips will be attached to. The formula does the opposite of what I want, so I thought it would be easy to reverse it, but I don't think it's that easy, and I'm certainly not capable of it.
50p Posted February 7, 2008 Posted February 7, 2008 If you still haven't got the formula then here is a LUA function: function convertWorldXYToMapXY( x, y, imageSize_x, imageSize_y ) return ((x*512)/6000)+(imageSize_x/2), ((-1*y*512)/6000)+(imageSize_y/2) end returns: converted x and y of the "game's world" coords to map's image coords PS. the conversion "stolen" from Xtream's Vehicle Map Plotter
Hell_Demon Posted February 8, 2008 Posted February 8, 2008 Do you try to make it on the F11 map? Or another map? for F11 map you can use createBlipAttachedToElement or sth.
Guest Posted February 8, 2008 Posted February 8, 2008 If you still haven't got the formula then here is a LUA function: function convertWorldXYToMapXY( x, y, imageSize_x, imageSize_y ) return ((x*512)/6000)+(imageSize_x/2), ((-1*y*512)/6000)+(imageSize_y/2) end returns: converted x and y of the "game's world" coords to map's image coords Thanks! It was off by a bit when I first tried it, but I changed it to this: function convertWorldXYToMapXY( x, y, imageSize_x, imageSize_y ) return ((x*imageSize_x)/6000)+(imageSize_x/2), ((-1*y*imageSize_y)/6000)+(imageSize_y/2) end And it worked perfectly. Do you try to make it on the F11 map? Or another map? for F11 map you can use createBlipAttachedToElement or sth. Nope, I'm using the "Radar Teleport" map script, which I believe I got here: https://forum.multitheftauto.com/viewtopic.php?f=91&t=21256&p=268591&hilit=radarteleport#p268319
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now