Jump to content

Vehicle hud


Snow-Man

Recommended Posts

i have made vehicle hud but i'm asking if it's fully correct, it's works fine in my resolution and differents ones but need to fix it 

local max = (math.floor(getVehicleHandling(vehicle)["maxVelocity"])*3.6)
exports.USCmisc:DxDrawBorderedRectangle(sX*(1061/msX)+(sX)*(mph/(max*1.49)), sY*(824/msY), sX*(3/msX), sY*(25/msY), tocolor(145, 0, 0, 255), 2)

 

Link to comment
local sX,sY = guiGetScreenSize()
lcoal x, y, w, h = sX, sY, 30, 250
local max = (math.floor(getVehicleHandling(vehicle)["maxVelocity"])*3.6)
exports.USCmisc:DxDrawBorderedRectangle(x-h-50, y-200, w, h*(mph/(max*1.49)), tocolor(145, 0, 0, 255), 2)

You need to work like this

Link to comment
  • 1 month later...
2 hours ago, Snow-Man said:

i don't mean that, i tried to do speed meter with x movements to bar, that's code it's working fine but i think it's got alot of problems, 

try this

local sx,sy = guiGetScreenSize(); 

addEventHandler( "onClientRender", root,
function()
	local vehicle = getPedOccupiedVehicle ( localplayer ) 
	if ( vehicle ) then
		local handling = getVehicleHandling ( vehicle )
		local Velo = handling["maxVelocity"]
	    local spx, spy, spz = getElementVelocity( vehicle )  
		local Speed = ( spx^2 + spy^2 + spz^2 ) ^ 0.5 * 1.61 * 100
        dxDrawRectangle(sx*(1108.0/1366),sy*(727.0/768),Speed/Velo*sx*(233.0/1366),sy*(13.0/768),tocolor(255,0,200,150),false)
   end
end );

you can change your  absolute position of the rectangle

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