Jump to content

[HELP] Map window, player blip


Recommended Posts

Hello guys, I am making the world's map on a window, and I want to make a blip that attaches to every player on the server. The problem is, I don't know how to make the blip rotate on the guy image/map as on the radar..

Here is the code:

function drawNFSBlips() 
    if not isNFSMapWindowShown() then return end 
    local players = getElementsByType( "player" ) 
     
    for i, p in pairs(players) do 
         
        local x, y, z = getElementPosition(getPedOccupiedVehicle(p)) 
         
        local  = (x/scaleX)+0.5*(mapWidth+2*mapX) 
        local yd = (y/-scaleY)+0.5*(mapHeight+2*mapY) 
        dxDrawImage ( -4, yd-4, 8, 8, "playerBlip.png" )   
    end 
end 
  

Link to comment
Try the 3rd argument of getElementRotation.

It doesn't even get drawn...

function drawNFSMap() 
    choosePositionWindow = guiCreateWindow ( choosePositionWindowPosX, choosePositionWindowPosY, choosePositionWindowWidth, choosePositionWindowHeight, "WORLD MAP", false ) 
    choosePositionMap = guiCreateStaticImage(0, 0.04, 1, 0.90, "map.png", true, choosePositionWindow) 
    mapX, mapY = guiGetPosition(choosePositionMap, false) 
    mapX = mapX+choosePositionWindowPosX 
    mapY = mapY+choosePositionWindowPosY 
    mapWidth, mapHeight = guiGetSize(choosePositionMap, false) 
    scaleX = 3000/(mapWidth/2) 
    scaleY = 3000/(mapHeight/2) 
    guiSetVisible(choosePositionWindow, true) 
end 
  
function showNFSMap() 
    if isElement(choosePositionWindow) then 
        destroyElement(choosePositionWindow) 
        removeEventHandler("onClientRender", root, drawNFSBlips) 
    else 
        drawNFSMap() 
        addEventHandler("onClientRender", root, drawNFSBlips) 
    end 
end 
function drawNFSBlips() 
    if not isNFSMapWindowShown() then return end 
    local players = getElementsByType( "player" ) 
     
    for i, p in pairs(players) do 
         
        local x, y, z = getElementPosition(getPedOccupiedVehicle(p)) 
        local rot1, rot2, rot3 = getElementRotation(getPedOccupiedVehicle(p)) 
         
        local  = (x/scaleX)+0.5*(mapWidth+2*mapX) 
        local yd = (y/-scaleY)+0.5*(mapHeight+2*mapY) 
        dxDrawImage ( -4, yd-4, 8, 8, "playerBlip.png", rot3, nil, nil, false, true )  
    end 
end 

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...