Jump to content

One question


Cadu12

Recommended Posts

Posted

Well, you gotta make that part, do you think you can request stuff and get it done?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Do you mean, you are saying you can request stuff and get it done? lol?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I can do it, but i dont knows how do it center

We can make X and Y?

edit:

there is code:

function dxDrawColorText(str, ax, ay, bx, by, color, scale, font) 
    local pat = "(.-)#(%x%x%x%x%x%x)" 
    local s, e, cap, col = str:find(pat, 1) 
    local last = 1 
    while s do 
    if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end 
        if s ~= 1 or cap ~= "" then 
            local w = dxGetTextWidth(cap, scale, font) 
            dxDrawText(cap, ax, ay, ax + w, by, color, scale, font, "center", "bottom", false, false, false ) 
            ax = ax + w 
            color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) 
        end 
        last = e + 1 
        s, e, cap, col = str:find(pat, last) 
    end 
    if last <= #str then 
        cap = str:sub(last) 
        local w = dxGetTextWidth(cap, scale, font) 
        dxDrawText(cap, ax, ay, ax + w, by, color, scale, font, "center", "bottom", false, false, false ) 
    end 
end 

Ingame nick: Cadu12

Posted

It's very simple to get it centered:

local sx,sy = guiGetScreenSize() --get player's current resolution 
dxDrawText('Text',sx/2-70,sy/2-20,sx/2+70,sy/2+20,tocolor(255,170,0,255),1.0,'bankgothic','center','center') -- draw text in the center according to resolution  

Powered by Kimsufi©

n-560x95_FFFFFF_FFFFFF_000000_000000.png

ZHP on FacebookZHP on YoutubeSupport us

Posted

He gave you the code, use it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You wanted this for player nametag?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Then, you should have told us that before.

function dxDrawColorText(str, ax, ay, bx, by, color, scale, font) 
    local pat = "(.-)#(%x%x%x%x%x%x)" 
    local s, e, cap, col = str:find(pat, 1) 
    local last = 1 
    while s do 
    if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end 
        if s ~= 1 or cap ~= "" then 
            local w = dxGetTextWidth(cap, scale, font) 
            dxDrawText(cap, ax, ay, ax + w, by, color, scale, font, "center", "bottom", false, false, false ) 
            ax = ax + w 
            color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) 
        end 
        last = e + 1 
        s, e, cap, col = str:find(pat, last) 
    end 
    if last <= #str then 
        cap = str:sub(last) 
        local w = dxGetTextWidth(cap, scale, font) 
        dxDrawText(cap, ax, ay, ax + w, by, color, scale, font, "center", "bottom", false, false, false ) 
    end 
end 
  
function drawPlayerTags() 
for i,v in ipairs(getElementsByType("player")) do 
if not v == getLocalPlayer() then 
local name = getPlayerName(v) 
local x,y,z = getElementPosition(v) 
local cx,cy,cz = getCameraMatrix() 
if isLineOfSightClear(cx,cy,cz,x,y,z,true,true,false,true,false,true,false,v) then 
if getDistanceBetweenPoints3D(cx,cy,cz,x,y,z) <= 45 then 
local px,py = getScreenFromWorldPosition(x,y,z+0.3,0.06) 
if px then 
r,g,b = getPlayerNametagColor(v) 
dxDrawColorText(name, px-60, py, px, py, tocolor(r, g, b, 255), 2, "default") 
           end 
         end  
      end 
    end 
  end 
end 
addEventHandler("onClientRender",getRootElement(),drawPlayerTags) 

There, it works fine here, should work "there" too.

And please, don't think we're your "slaves" our something like that ;)

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I can, but that doesn't means i will :)

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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