Jump to content

Draw blip according to world position on dxDrawImage map


Recommended Posts

I'll get straight to the point.

I want to allow players to draw lines and place markers on a custom map image. However, since telling said players to replace the default map (radar.jpg, found in MTA San Andreas 1.4/MTA/cgui/images) would be too much, I figured I'd simply draw the map and use bindKey to show or hide the map. Said map is 3200x3200 in size.

In any case, I've stumbled across a lot of problems. First of, if you use guiCreateStaticImage, the image looks really weird.

Here's a screenshot (800x600):

So I tried using dxDrawImage, which produced more satisfying results (again, 800x600 resolution):


Now that's where my problem begins. The function createBlipAttachedTo only works for the radar (GPS) and the built-in map of MTA, meaning it's useless for what I intended to use it for. Now, how exactly do I draw a blip (which should be attached to the local player) according to the local player's position? By the way, the blip you see on the second image is just something I've drawn - my character was actually in Grove Street at the time of the screenshot.

The second problem I have is that I'd like to zoom the map on the player's location, so it won't show the entire map like the screenshot shows, but rather, around 10% of his immediate area. I realize this can be done using dxDrawImageSection, but again, how do you factor the player's position in?

Link to comment

You must be knowing math for this.

First of all, ignore Z of blips (you can use it if you want Ordering in your blips...)

Then, you must use getPlayerMapBoundingBox to get the Map size (or get it by your drawing funcition),

And finaly, play around with direct proportionality to transform 3000x3000 into YOURMAPXxYOURMAPY

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...