Jump to content

[HELP] Radar efficiency


LabiVila

Recommended Posts

Hello,

local x,y = guiGetScreenSize () 
local mapSmallness = 5 
  
--Handle render target; 
addEventHandler ("onClientResourceStart", getRootElement(), 
    function () 
        renderTarget = dxCreateRenderTarget (180, 180, true) 
    end 
) 
  
--Keep the map appeared; 
addEventHandler ("onClientRender", getRootElement(), 
    function () 
        if renderTarget then 
            dxSetRenderTarget (renderTarget) 
            ---------------------------------- 
            local _, _, pedRotation = getElementRotation (localPlayer) 
             
            dxDrawRectangle (0, 0, 180, 180, tocolor (0, 0, 0, 150)) 
            dxDrawImage (80, 80, 20, 20, "blip_player.png", pedRotation) 
             
            getBlips () 
            ---------------------------------- 
            dxSetRenderTarget () 
             
            dxDrawImage (20, 400, 180, 180, renderTarget) 
        end 
    end 
) 
  
--Created blips; 
function getBlips () 
    local myX, myY = getElementPosition (localPlayer) 
     
    for i,v in ipairs (getElementsByType ("object")) do 
        if (getElementModel (v) == 673) then 
            local treeX, treeY = getElementPosition (v) 
            dxDrawRectangle (87.5 + (myX - treeX) * mapSmallness, 87.5 + (myY - treeY) * mapSmallness, 6, 6, tocolor (0, 255, 0, 150)) 
        end 
        if (getElementModel (v) == 746) then 
            local rockX, rockY = getElementPosition (v) 
            dxDrawRectangle (87.5 + (myX - rockX) * mapSmallness, 87.5 + (myY - rockY) * mapSmallness, 6, 6, tocolor (0, 255, 0, 150))       
        end 
        if (getElementModel (v) == 3276) then 
            local fenceX, fenceY = getElementPosition (v) 
            dxDrawRectangle (87.5 + (myX - fenceX) * mapSmallness, 87.5 + (myY - fenceY) * mapSmallness, 6, 6, tocolor (0, 255, 0, 150))     
        end 
    end 
end 
  

so the radar works fine but I can't manage to make it work as I want. Currently when you rotate, it's the player's blip that moves but I don't want this (since it seems quite messed up on gameplay). I want the player's blip to stand still (not moving, not rotating) but the objects behind should move when you rotate. So I'm having problems with player's blip, it works strangely. Thanks further

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