Jump to content

dxDrawText Hext Color Problem


Recommended Posts

Hey dear community, I hope you can help me with this easy problem which I have.

I want to add and see Hex colors into the text, I tried to set some arguments "true" but it didn't work.

local contador = 3 
local alfa = 0 
local movimiento = "fadein" 
local screenWidth, screenHeight = guiGetScreenSize() 
  
  
------------------------------------------------------------------------------ 
  
  
function createText () 
  
if movimiento == "fadein" then 
contador = contador+1 
else 
contador = contador-1 
end 
  
if contador <= 100 then alfa = 255*(contador/100) end 
    dxDrawText("#000000"..getPlayerName(getLocalPlayer()).." #000000is the final survivor!", screenWidth/2, screenHeight/3, screenWidth/2, screenHeight/3.5, tocolor ( 255,255, 255, alfa ), 3.22, "default-bold","center") 
if contador == 2 then 
removeEventHandler("onClientRender",getRootElement(),createText) 
end 
  
if contador == 200 then 
contador = 100 
movimiento = "negativo" 
end 
     
     
     
end 
  
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
  
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) 

Ir show me the hex color code by the player and I wont it.

I hope you can help me.

Regards.

Link to comment

try this

local contador = 3 
local alfa = 0 
local movimiento = "fadein" 
local screenWidth, screenHeight = guiGetScreenSize() 
  
  
------------------------------------------------------------------------------ 
  
  
function createText () 
  
if movimiento == "fadein" then 
contador = contador+1 
else 
contador = contador-1 
end 
  
if contador <= 100 then alfa = 255*(contador/100) end 
    dxDrawText("#000000"..getPlayerName(getLocalPlayer()).." #000000is the final survivor!", screenWidth/2, screenHeight/3, screenWidth/2, screenHeight/3.5, tocolor ( 255,255, 255, alfa ), 3.22, "default-bold","center", false,false,false,true) 
if contador == 2 then 
removeEventHandler("onClientRender",getRootElement(),createText) 
end 
  
if contador == 200 then 
contador = 100 
movimiento = "negativo" 
end 
    
    
    
end 
  
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
  
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) 

Link to comment

You forgot alignY argument.

local contador = 3 
local alfa = 0 
local movimiento = "fadein" 
local screenWidth, screenHeight = guiGetScreenSize() 
  
  
------------------------------------------------------------------------------ 
  
  
function createText () 
  
if movimiento == "fadein" then 
contador = contador+1 
else 
contador = contador-1 
end 
  
if contador <= 100 then alfa = 255*(contador/100) end 
    dxDrawText("#000000"..getPlayerName(getLocalPlayer()).." #000000is the final survivor!", screenWidth/2, screenHeight/3, screenWidth/2, screenHeight/3.5, tocolor ( 255,255, 255, alfa ), 3.22, "default-bold","center", "top", false,false,false,true) 
if contador == 2 then 
removeEventHandler("onClientRender",getRootElement(),createText) 
end 
  
if contador == 200 then 
contador = 100 
movimiento = "negativo" 
end 
    
    
    
end 
  
function HandleTheRendering ( ) 
    addEventHandler ( "onClientRender", root, createText ) 
end 
  
addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) 

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