Jump to content

[Help] dxDrawText


HUNGRY:3

Recommended Posts

hello every body

so.....

i made join quit with dxdrawtext but when i change my nick or some one join it just show for 1 sec or i should say half of the second

i know i must use "onClientRender"

but idk where to put it

addEventHandler("onClientPlayerJoin", root, 
    function() 
    dxDrawText("* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."has joined the game", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
    dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
    end) 
  
  
  
  
  
addEventHandler("onClientPlayerChangeNick", root, 
    function(old, new) 
    old = old:gsub("#%x%x%x%x%x%x","") 
    new = new:gsub("#%x%x%x%x%x%x","") 
        if old ~= new then 
        dxDrawText("* "..old.."is now known as"..new, 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
        end 
    end) 
  
     
addEventHandler("onClientPlayerQuit", root, 
    function(reason) 
    dxDrawText("*"..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."#006400 has left the game [#FFFFFF" .. reason .. "#006400]", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
    dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
    end) 

Link to comment
  
addEventHandler("onClientPlayerJoin", root, 
        function() 
addEventHandler("onClientRender", root, function ()  
        dxDrawText("* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."has joined the game", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end 
        end)      
    addEventHandler("onClientPlayerChangeNick", root, 
        function(old, new) 
        old = old:gsub("#%x%x%x%x%x%x","") 
        new = new:gsub("#%x%x%x%x%x%x","") 
            if old ~= new then 
addEventHandler("onClientRender", root , function ( ) 
            dxDrawText("* "..old.."is now known as"..new, 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
            dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end 
            end 
        end) 
    addEventHandler("onClientPlayerQuit", root, 
        function(reason) 
addEventHandler("onClientRender", root, function ( ) 
        dxDrawText("*"..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."#006400 has left the game [#FFFFFF" .. reason .. "#006400]", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end 
        end) 
  

Link to comment

your script didn't work but i fixed it

there's now another problem

when i change my nick it stays for ever

i tryed settimer but didn't work here's the code :

  
  
local nick  
  
addEventHandler("onClientPlayerJoin", root, 
        function() 
addEventHandler("onClientRender", root, function () 
        dxDrawText("* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." has joined the game ", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end) 
        end)    
    addEventHandler("onClientPlayerChangeNick", root, 
        function(old, new) 
        old = old:gsub("#%x%x%x%x%x%x","") 
        new = new:gsub("#%x%x%x%x%x%x","") 
            if old ~= new then 
addEventHandler("onClientRender", root , function ( ) 
            nick = dxDrawText("* "..old.." is now known as "..new, 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
            dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)  
end) 
end 
setTimer(nick,500,1) 
  
    addEventHandler("onClientPlayerQuit", root, 
        function(reason) 
addEventHandler("onClientRender", root, function ( ) 
        dxDrawText("* "..getPlayerName(source):gsub("#%x%x%x%x%x%x","").." #006400 has left the game [#FFFFFF" .. reason .. "#006400]", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end) 
        end) 
  
    end) 
  

Link to comment
  
  
local join 
local quitInfo 
local nick 
  
addEventHandler("onClientPlayerChangeNick", root, 
      function (old, new) 
             nick = old .. ";" .. new 
             addEventHandler("onClientRender", root, nickRender) 
             setTimer(removeEventHandler, 2500, 1, "onClientRender", root, nickRender) 
      end 
) 
  
  
addEventHandler("onClientPlayerJoin", root, 
      function () 
             join = getPlayerName(source) 
             addEventHandler("onClientRender", root, joinRender) 
             setTimer(removeEventHandler, 2500, 1, "onClientRender", root, joinRender) 
      end 
) 
  
  
addEventHandler("onClientPlayerQuit", root, 
      function (reason) 
             quitInfo = getPlayerName(source) .. ";" .. reason 
             addEventHandler("onClientRender", root, quitRender) 
             setTimer(removeEventHandler, 2500, 1, "onClientRender", root, quitRender) 
      end 
) 
  
function nickRender () 
table = split(nick, ";") 
old, new = table[1], table[2] 
            dxDrawText("* "..old.." is now known as "..new, 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
            dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)  
end 
  
function joinRender () 
dxDrawText("* "..join:gsub("#%x%x%x%x%x%x","").." has joined the game ", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end 
  
function quitRender() 
table = split(quitInfo, ";") 
qName, qReason = table[1], table[2] 
 dxDrawText("* "..quit:gsub("#%x%x%x%x%x%x","").." #006400 has left the game [#FFFFFF" .. reason .. "#006400]", 38, 507, 230, 522, tocolor(255, 255, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false) 
        dxDrawImage(0, 497, 28, 25, "join.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
end 
  

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