Jump to content

Change hud position


Kors

Recommended Posts

local localPlayer = getLocalPlayer ()

local theTimer2 = nil

local color1 = tocolor( 0, 0, 0, 255 )
local color2 = tocolor( 255, 0, 0, 150 )
local color3 = tocolor( 255, 200, 0, 150 )
local color4 = tocolor( 2, 59, 242, 150 )
local font = dxCreateFont ("myriadproregular.ttf",14)
local megjelenit = true
rot = 0

unbindKey ( "home" )

setElementData(localPlayer,"hud:main",true,false)

function funkcio()
setElementHealth(getLocalPlayer(), getElementHealth(getLocalPlayer()) - 1)
end

function math.round(number, decimals, method)
    decimals = decimals or 0
    local factor = 10 ^ decimals
    if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
    else return tonumber(("%."..decimals.."f"):format(number)) end
end

function hudStatusz(statusz)
	megjelenit = statusz
end

function getHudStatusz()
	return megjelenit
end

How to change position to left, bot  

Link to comment
local localPlayer = getLocalPlayer ()

local theTimer2 = nil

local color1 = tocolor( 0, 0, 0, 255 )
local color2 = tocolor( 255, 0, 0, 150 )
local color3 = tocolor( 255, 200, 0, 150 )
local color4 = tocolor( 2, 59, 242, 150 )
local font = dxCreateFont ("myriadproregular.ttf",14)
local megjelenit = true
rot = 0

unbindKey ( "home" )

setElementData(localPlayer,"hud:main",true,false)

function funkcio()
setElementHealth(getLocalPlayer(), getElementHealth(getLocalPlayer()) - 1)
end

function math.round(number, decimals, method)
    decimals = decimals or 0
    local factor = 10 ^ decimals
    if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
    else return tonumber(("%."..decimals.."f"):format(number)) end
end

function hudStatusz(statusz)
	megjelenit = statusz
end

function getHudStatusz()
	return megjelenit
end

function hud()
	local hp = tonumber(getElementHealth(getLocalPlayer()))
	local armor = tonumber(getPedArmor(getLocalPlayer()))
	local money = getPlayerMoney(localPlayer)
	local scx, scy = guiGetScreenSize()
	local svx, svy = guiGetScreenSize()
	local x, y = scx-193 - 47, 10
	local xx = svx - 200
	local xxx = scx + 50
	
	img = dxDrawImage(xx-190, 20, 374, 91, "bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)

	dxDrawText(math.round(hp,0).."%", xxx-360, 47.5, 7, 22.5, tocolor ( 200, 200, 200 ), 0.8, font, "left","top",false,false,true,true)

	dxDrawText(math.round(armor,0).."%", xxx-140, 47.5, 7, 22.5, tocolor ( 200, 200, 200 ), 0.8, font, "left","top",false,false,true,true)
	dxDrawText(math.round(money,0).."$", xxx-270, 47.5, 7, 22.5, tocolor ( 200, 200, 200 ), 0.8, font, "left","top",false,false,true,true)
	
end
addEventHandler("onClientRender", getRootElement(), hud)

function penz_darabolas(amount)
  local formatted = amount
  while true do  
    formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2')
    if (k==0) then
      break
    end
  end
  return formatted
end

function onClientRenderR()
	local theVehicle = getPedOccupiedVehicle ( getLocalPlayer() )
	if theVehicle then
		local vehmodel = getElementModel(theVehicle)
		if vehmodel == 481 or vehmodel == 509 or vehmodel == 510 then
			speed = exports.rp_core:getVehicleVelocity(theVehicle)
			if speed > 40 then
				toggleControl ( "accelerate", false )
			elseif not isControlEnabled("accelerate") then
				toggleControl ( "accelerate", true )
			end
		end
	end
end
addEventHandler("onClientRender", getRootElement(), onClientRenderR)

How change position to left , bot to all sreensize

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