..:D&G:.. Posted May 17, 2015 Posted May 17, 2015 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
..:D&G:.. Posted May 17, 2015 Author Posted May 17, 2015 I seen that..duh.. But how does it work? That is only 1 argument, and getElementRotation gives me 3...
..:D&G:.. Posted May 17, 2015 Author Posted May 17, 2015 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
WhoAmI Posted May 17, 2015 Posted May 17, 2015 dxDrawImage ( -4, yd-4, 8, 8, "playerBlip.png", rot3, 0, 0, tocolor(255,255,255,255), true )
..:D&G:.. Posted May 17, 2015 Author Posted May 17, 2015 dxDrawImage ( -4, yd-4, 8, 8, "playerBlip.png", rot3, 0, 0, tocolor(255,255,255,255), true ) It works thanks
..:D&G:.. Posted May 17, 2015 Author Posted May 17, 2015 Oh, I just noticed something. When I turn left, the pointer turns right, I tried to fix it but can't figure it out. Maybe you know what's wrong?
WhoAmI Posted May 17, 2015 Posted May 17, 2015 Change "rot3" to "rot3 - 180" or "rot3 + 180". Check what works.
..:D&G:.. Posted May 17, 2015 Author Posted May 17, 2015 Same thing.. EDIT: Here is the blip if it helps, maybe is cuz of the way it is pointing..
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