Jump to content

help arearadar :(


Jacobob14

Recommended Posts

hello

I'm trying to do the radar area

but I is not going very well could someone please help me :(

http://prntscr.com/318f3v

local screenx, screeny = guiGetScreenSize( ); 
local posX = 30; 
local posY = 157; 
-- Make sure it's the right values 
local width1 = 135; 
local height1 = 135; 
-- 
local scale = 0.67; 
local texture = dxCreateTexture( 'images/sattelite.png', 'dxt5', true, 'clamp' ); 
imagewidth1, imageheight1 = dxGetMaterialSize( texture ); 
  
showPlayerHudComponent( "radar", false ) 
     
  
  
addEventHandler("onClientRender",root, 
    function( ) 
    
        local px ,py, pz = getElementPosition( localPlayer ) 
        local mapX = px / ( 6000 / imagewidth1 ) + ( imagewidth1 / 2 ) - ( width1 / scale / 2 ); 
        local mapY = py / ( -6000 / imageheight1 ) + ( imageheight1 / 2 ) - ( height1 / scale / 2 ); 
        local cx,cy,cz,tx,ty,tz = getCameraMatrix( ); 
        local rotation = getCameraRotation(); 
        dxDrawImageSection( posX, screeny - posY, width1, height1, mapX, mapY, width1 / scale, height1 / scale, texture, rotation, 0, 0, tocolor( 255, 255, 255, 220 ), false ); 
  
        --dxDrawRectangle( posX + width1 / 2, screeny - posY + height1 / 2, 5, 5, tocolor( 0, 0, 255, 255 ) ); 
        
dxDrawImage(posX, screeny - posY, width1, height1, "/images/blips/guia.png" , rotation ); 
        
        for i, v in ipairs( getElementsByType('radararea') ) do 
                            local r,g,b,a = getRadarAreaColor(v) 
                            local w,h = getRadarAreaSize(v) 
                            x,y = getElementPosition(v) 
                             
                            x = x / (6000 / mapX)  + mapX/2  
                            y = y / (-6000/ mapY) + mapY/2  
                            dxDrawRectangle(x, (y-h) + 4 + (h/2), (w/2), (h/2), tocolor(r,g,b,a)) 
                             
                    end 

Link to comment
  • Moderators

Why are you trying to modify or to do the hard stuff when you are still a beginner ?

You should first start by making easy systems with server and client codes (with dx functions maybe) before doing hard stuff like making your own radar.

And yeah I'm helping you right now by saying that, for the future.

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