# Player Map Math ## Recommended Posts 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. 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).

I suggest analizing this script: viewtopic.php?f=91&t=21256 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. 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

Do you try to make it on the F11 map? Or another map? for F11 map you can use createBlipAttachedToElement or sth. 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

## Create an account

Register a new account