Jump to content

Scale dx text in one spot


VenomOG

Recommended Posts

Hello

Code:
 



addEventHandler("onClientRender", root,
    function()
        dxDrawRectangle(0, 93, 1366, 143, tocolor(16, 15, 15, 197), false)
        dxDrawText("Rank Up !", 610, 60, 860, 136, tocolor(56, 229, 10, 212), 2.50, "pricedown", "left", "top", false, false, false, false, false)
        dxDrawText("          Mugger", 534, 166, 908, 226, tocolor(237, 174, 3, 212), 1.90, "pricedown", "left", "top", false, false, false, false, false)
    end
)

So basically i am wondering if there is a way i can make a dx text stay one place like if the text was
Chief Of Gangster it will be out of bound and not where i want it or Mugger will be far from where i want it under Rank Up!
Any suggestions?

Link to comment
On 25/08/2019 at 13:37, Network said:

How can this help my situation?
example please.

local text1 = 'Rank Up !'
local text2 = 'Mugger'
local scale = 1
local font = "pricedown"
local x,y,w,h = 10, 500,300, 66
-----
addEventHandler("onClientRender", root,function()
local w1 = dxGetTextWidth(text1..'\n'..text2,scale,font)
dxDrawRectangle(x,y,w+w1-295,h, tocolor(0, 0, 0,197), false)
dxDrawText(text1..'\n'..text2,x,y,w+x,h+y,tocolor(237, 174, 3, 212),scale,font, "left", "center",   false, false, false, true, false)
end)

 

Link to comment
local text1 = 'Rank Up !'
local text2 = 'Mugger'
local scale = 2.50
local font = "pricedown"
local x,y,w,h = 10,500,300, 66
-----
addEventHandler("onClientRender", root,function()
local offset = dxGetFontHeight(scale,font)
local w1 = dxGetTextWidth(text1..'\n'..text2,scale,font)
dxDrawRectangle(x,y-offset,w+w1-295,h+offset, tocolor(0, 0, 0,197), false)
dxDrawText(text1..'\n'..text2,x,y-offset,w+x,h+y,tocolor(237, 174, 3, 212),scale,font, "left", "center",   false, false, false, true, false)
end)

#Edit

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