Jump to content

Effect on DxDraw [HELP]


Recommended Posts

local x,y = guiGetScreenSize() 
local admin = "" 
local mensagem = "" 
local iv = false 
local ATIVADO = false 
a1 = 200 
a2 = 255 
  
addEvent("show", true) 
function mostrar(player, msg) 
    mensagem = msg 
    admin = player 
    ATIVADO = true 
    a1 = 200 
    a2 = 255 
    if (isTimer(timer1)) then killTimer(timer1) end 
    timer1 = setTimer(function() 
        setTimer(function() 
            if a1 > 0 then 
                a1 = a1 - 5 
            end 
            if a2 > 0 then 
                a2 = a2 - 5 
            end 
            if a1 <= 0 and a2 <= 0 then 
                ATIVADO = false 
                admin = "" 
                mensagem = "" 
            end 
        end, 50, 53) 
    end, 6000, 1) 
end 
addEventHandler("show", getRootElement(), mostrar) 
  
function drawStuff() 
    if (ATIVADO == true) then 
        dxDrawRectangle ( x/50, y/2.8, x/3, y/5, tocolor ( 87, 27, 239, a1 ) ) 
        dxDrawRectangle ( x/50, y/2.8, x/3, y/30, tocolor ( 0, 43, 65, a2) ) 
        dxDrawText (string.gsub ( admin, "#%x%x%x%x%x%x", "" ), x/40, y/1.42, x/4.6, y/25, tocolor ( 0, 0, 0, 255 ), 1, "sans", "center", "center", false, false, false, false) 
  dxDrawText (string.gsub ( admin, "#%x%x%x%x%x%x%x%x", "" ), x/40, y/1.42, x/4.6, y/25, tocolor ( 255, 255, 255, 255 ), 1, "sans", "center", "center", false, false, false, true)        dxDrawText ( mensagem, x/32, y/2.52, x/4.6, y/2.4, tocolor ( 255, 0, 0, 255 ), 0.0, "clear", "left", "top", true, true, false, false) 
        dxDrawText ( mensagem, x/35, y/2.53, x/4.0, y/1.1, tocolor ( 255, 255, 0, 255 ), 1.2, "clear", "left", "top", true, true, false, false)        end 
end 
addEventHandler("onClientRender", root, drawStuff) 

I have a script that creates a DxDrawText

It is this:

 

I want to put an effect that looks like the rectangle / DxDrawnText:

         dxDrawRectangle (x / 50, y / 2.8, x / 3, y / 5, tocolor (87, 27, 239, 200))

         dxDrawRectangle (x / 50, y / 2.8, x / 3, y / 30, tocolor (0, 0, 0, 200))

Flashes slowly

Edited by Guest
Link to comment

Do you mean doing something like this?

local x,y = guiGetScreenSize() 
local admin = "" 
local mensagem = "" 
local iv = false 
local ATIVADO = false 
a1 = 200 
a2 = 255 
  
local lastColorChange = getTickCount ( ); 
local color = 1; 
  
addEvent("show", true) 
function mostrar(player, msg) 
    lastColorChange = getTickCount ( ); 
    lastColor = 1; 
  
    mensagem = msg 
    admin = player 
    ATIVADO = true 
    a1 = 200 
    a2 = 255 
    if (isTimer(timer1)) then killTimer(timer1) end 
    timer1 = setTimer(function() 
        setTimer(function() 
            if a1 > 0 then 
                a1 = a1 - 5 
            end 
            if a2 > 0 then 
                a2 = a2 - 5 
            end 
            if a1 <= 0 and a2 <= 0 then 
                ATIVADO = false 
                admin = "" 
                mensagem = "" 
            end 
        end, 50, 53) 
    end, 6000, 1) 
end 
addEventHandler("show", getRootElement(), mostrar) 
  
function drawStuff() 
  if (ATIVADO == true) then 
    if ( getTickCount() - lastColorChange >= 3000 ) then  
      lastColorChange = getTickCount ( ); 
  
      if ( lastColor == 1 ) then  
        lastColor = 2; 
      else  
        lastColor = 1; 
      end 
    end  
  
    if ( lastColor == 1 ) then  
      dxDrawRectangle ( x/50, y/2.8, x/3, y/5, tocolor ( 87, 27, 239, a1 ) ) 
      dxDrawRectangle ( x/50, y/2.8, x/3, y/30, tocolor ( 0, 43, 65, a2) ) 
    else  
      dxDrawRectangle ( x/50, y/2.8, x/3, y/5, tocolor ( 255, 255, 255, a1 ) ) 
      dxDrawRectangle ( x/50, y/2.8, x/3, y/30, tocolor ( 200, 200, 200, a2) ) 
    end 
     
    dxDrawText (string.gsub ( admin, "#%x%x%x%x%x%x", "" ), x/40, y/1.42, x/4.6, y/25, tocolor ( 0, 0, 0, 255 ), 1, "sans", "center", "center", false, false, false, false) 
    dxDrawText (string.gsub ( admin, "#%x%x%x%x%x%x%x%x", "" ), x/40, y/1.42, x/4.6, y/25, tocolor ( 255, 255, 255, 255 ), 1, "sans", "center", "center", false, false, false, true)         
    dxDrawText ( mensagem, x/32, y/2.52, x/4.6, y/2.4, tocolor ( 255, 0, 0, 255 ), 0.0, "clear", "left", "top", true, true, false, false) 
    dxDrawText ( mensagem, x/35, y/2.53, x/4.0, y/1.1, tocolor ( 255, 255, 0, 255 ), 1.2, "clear", "left", "top", true, true, false, false)         
  end 
end 
addEventHandler("onClientRender", root, drawStuff) 

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...