Jump to content

Need a help in joinquit


Recommended Posts

Hey guys! Today I made a dxDraw script which is shows who joined/quited to/from the server. But it doesn't show the player's name! I tried everything but it doesn't work. Debugscript shows me 2 errors:

414626173kep_www.kepfeltoltes.hu_.png

And the name is not shown, as you can see on the right. How can I fix this?

Here's the code:

function drawJoin() 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(getPlayerName(source), 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("csatlakozott a szerverre.", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawQuit(reason) 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(getPlayerName(source), 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverről. ("..reason..")", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler("onClientPlayerJoin", root, 
function() 
    addEventHandler("onClientRender", root, drawJoin) 
    local sound = playSound("bip.wav") 
    setTimer ( function() 
        removeEventHandler("onClientRender", root, drawJoin) 
    end, 5000, 1 ) 
end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
function() 
    addEventHandler("onClientRender", root, drawQuit) 
    local sound = playSound("bip.wav") 
    setTimer ( function() 
        removeEventHandler("onClientRender", root, drawQuit) 
    end, 5000, 1 ) 
end 
) 

Please help me. Thank you!

Edited by Guest
Link to comment
You must get the player name inside onClientPlayerJoin and store it in a variable.

Do you mean this?

  
  
-- Dx things 
  
dxDrawText(name, 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
  
-- Dx things 
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        name = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawJoin) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawJoin) 
        end, 5000, 1 ) 
    end 
) 

Link to comment
But where is the function "drawJoin"?
function drawJoin() 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(name, 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("csatlakozott a szerverre.", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 

Link to comment
Post your full code please.

I have already posted it at the beginning

function drawJoin() 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(getPlayerName(source), 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("csatlakozott a szerverre.", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawQuit(reason) 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(getPlayerName(source), 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverről. ("..reason..")", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        addEventHandler("onClientRender", root, drawJoin) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawJoin) 
        end, 5000, 1 ) 
    end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
    function() 
        addEventHandler("onClientRender", root, drawQuit) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawQuit) 
        end, 5000, 1 ) 
    end 
) 

Link to comment
No, the new code.

Oh, sorry

function drawJoin() 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(nev, 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("csatlakozott a szerverre.", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawQuit(reason) 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(nev, 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverről. ("..reason..")", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        nev = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawJoin) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawJoin) 
        end, 5000, 1 ) 
    end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
    function() 
        nev = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawQuit) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawQuit) 
        end, 5000, 1 ) 
    end 
) 

Link to comment
local name = "" 
local reason = "" 
  
function drawJoin ( ) 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(name, 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("csatlakozott a szerverre.", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawQuit( ) 
    dxDrawRectangle(1411, 228, 269, 84, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(1411, 228, 269, 21, tocolor(245, 140, 20, 235), true) 
    dxDrawText("Csatlakozás / Kilépés", 1425, 234, 1680, 244, tocolor(254, 254, 254, 235), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText(name, 1470, 249, 1657, 280, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverrol. ("..reason..")", 1455, 285, 1675, 302, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        name = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawJoin) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawJoin) 
        end, 5000, 1 ) 
    end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
    function ( reason_ ) 
        name = getPlayerName(source) 
        reason = reason_ 
        addEventHandler("onClientRender", root, drawQuit) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawQuit) 
        end, 5000, 1 ) 
    end 
) 

Link to comment

Now the names are shown thank you! But now I have other problem. I tried to translate the reasons to my language, but it's not showing the reason when somebody quits or getting kicked or timedout or whatever. It just shows empty space. :(

local x, y = guiGetScreenSize() 
local sx, sy = guiGetScreenSize() 
local nev = "" 
local reason = "" 
  
if reason == "Unknown" then 
    reason = "Ismeretlen indok" 
end 
  
if reason == "Quit" then 
    reason = "Kilépés" 
end 
  
if reason == "Kicked" then 
    reason = "Kirúgva" 
end 
  
if reason == "Banned" then 
    reason = "Bannolva" 
end 
  
if reason == "Bad Connection" then 
    reason = "Rossz kapcsolat" 
end 
  
if reason == "Timed out" then 
    reason = "Időtúllépés" 
end 
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, sx*0.985, sy*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
--addEventHandler("onClientRender", root, drawCsatlakozas)  
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, sx*0.985, sy*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverről.", x*0.8660714, y*0.271428, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ "..reason.." ]", x*0.866071, y*0.3238095, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
--addEventHandler("onClientRender", root, drawKilepes)  
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        nev = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawCsatlakozas) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawCsatlakozas) 
        end, 5000, 1 ) 
    end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
    function ( reason ) 
        nev = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawKilepes) 
        end, 5000, 1 ) 
    end 
) 

Link to comment
local x, y = guiGetScreenSize() 
local sx, sy = guiGetScreenSize() 
local nev = "" 
  
local reasons =  
    { 
         
        ["unknown"] = "Ismeretlen.",  
        ["quit"] = "Kilépett.", 
        ["kicked"] = "Kirúgva.", 
        ["banned"] = "Kitiltva.", 
        ["bad connection"] = "Rossz kapcsolat.", 
        ["timed out"] = "Időtúllépés.", 
         
    } 
  
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, sx*0.985, sy*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
--addEventHandler("onClientRender", root, drawCsatlakozas) 
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, sx*0.985, sy*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverről.", x*0.8660714, y*0.271428, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ " .. reasons [ string.lower ( reason ) ] .." ]", x*0.866071, y*0.3238095, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
--addEventHandler("onClientRender", root, drawKilepes) 
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        nev = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawCsatlakozas) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawCsatlakozas) 
        end, 5000, 1 ) 
    end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
    function ( reason ) 
        nev = getPlayerName(source) 
        reason = reason 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawKilepes) 
        end, 5000, 1 ) 
    end 
) 

Edited by Guest
Link to comment
local x, y = guiGetScreenSize() 
local sx, sy = guiGetScreenSize() 
local nev = "" 
  
local reasons =  
    { 
         
        ["unknown"] = "Ismeretlen.",  
        ["quit"] = "Kilépett.", 
        ["kicked"] = "Kirúgva.", 
        ["banned"] = "Kitiltva.", 
        ["bad connection"] = "Rossz kapcsolat.", 
        ["timed out"] = "Időtúllépés.", 
         
    } 
  
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, sx*0.985, sy*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
--addEventHandler("onClientRender", root, drawCsatlakozas) 
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, sx*1, sy*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, sx*0.985, sy*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverről.", x*0.8660714, y*0.271428, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ " .. reasons [ string.lower ( reason ) ] .." ]", x*0.866071, y*0.3238095, sx*0.99702, sy*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
--addEventHandler("onClientRender", root, drawKilepes) 
  
addEventHandler("onClientPlayerJoin", root, 
    function() 
        nev = getPlayerName(source) 
        addEventHandler("onClientRender", root, drawCsatlakozas) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawCsatlakozas) 
        end, 5000, 1 ) 
    end 
) 
  
addEventHandler("onClientPlayerQuit", root, 
    function ( reason ) 
        nev = getPlayerName(source) 
        reason = reason 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound("bip.wav") 
        setTimer ( function() 
            removeEventHandler("onClientRender", root, drawKilepes) 
        end, 5000, 1 ) 
    end 
) 

I don't know why, but it's still not working :( And debugscript doesn't show me errors.

Link to comment
local x, y = guiGetScreenSize ( ) 
local nev = "" 
local reason = "" 
local reasons = 
    { 
        
        [ "unknown" ] = "Ismeretlen.", 
        [ "quit" ] = "Kilépett.", 
        [ "kicked" ] = "Kirúgva.", 
        [ "banned" ] = "Kitiltva.", 
        [ "bad connection" ] = "Rossz kapcsolat.", 
        [ "timed out" ] = "Idotúllépés.", 
        
    } 
  
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverrol.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ " .. tostring ( reason ) .." ]", x*0.866071, y*0.3238095, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler ( "onClientPlayerJoin", root, 
    function ( ) 
        nev = getPlayerName ( source ) 
        reason = "" 
        addEventHandler ( "onClientRender", root, drawCsatlakozas ) 
        local sound = playSound ( "bip.wav" ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawCsatlakozas ) 
            end 
            ,5000, 1 
        ) 
    end 
) 
  
addEventHandler ( "onClientPlayerQuit", root, 
    function ( reason ) 
        removeEventHandler ( "onClientRender", root, drawKilepes ) 
        nev = getPlayerName ( source ) 
        reason = reasons [ reason:lower ( ) ] 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound("bip.wav") 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawKilepes ) 
            end 
            ,5000, 1 
        ) 
    end 
) 

Link to comment
local x, y = guiGetScreenSize ( ) 
local nev = "" 
local reason = "" 
local reasons = 
    { 
        
        [ "unknown" ] = "Ismeretlen.", 
        [ "quit" ] = "Kilépett.", 
        [ "kicked" ] = "Kirúgva.", 
        [ "banned" ] = "Kitiltva.", 
        [ "bad connection" ] = "Rossz kapcsolat.", 
        [ "timed out" ] = "Idotúllépés.", 
        
    } 
  
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverrol.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ " .. tostring ( reason ) .." ]", x*0.866071, y*0.3238095, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler ( "onClientPlayerJoin", root, 
    function ( ) 
        nev = getPlayerName ( source ) 
        reason = "" 
        addEventHandler ( "onClientRender", root, drawCsatlakozas ) 
        local sound = playSound ( "bip.wav" ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawCsatlakozas ) 
            end 
            ,5000, 1 
        ) 
    end 
) 
  
addEventHandler ( "onClientPlayerQuit", root, 
    function ( reason ) 
        removeEventHandler ( "onClientRender", root, drawKilepes ) 
        nev = getPlayerName ( source ) 
        reason = reasons [ reason:lower ( ) ] 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound("bip.wav") 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawKilepes ) 
            end 
            ,5000, 1 
        ) 
    end 
) 

Not working :'( Now it just draws the [ ] but no reason.

Link to comment
local x, y = guiGetScreenSize ( ) 
local nev = "" 
local reason = "" 
local reasons = 
    { 
        
        [ "unknown" ] = "Ismeretlen.", 
        [ "quit" ] = "Kilépett.", 
        [ "kicked" ] = "Kirúgva.", 
        [ "banned" ] = "Kitiltva.", 
        [ "bad connection" ] = "Rossz kapcsolat.", 
        [ "timed out" ] = "Idotúllépés.", 
        
    } 
  
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverrol.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ " .. tostring ( reason ) .." ]", x*0.866071, y*0.3238095, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler ( "onClientPlayerJoin", root, 
    function ( ) 
        removeEventHandler ( "onClientRender", root, drawCsatlakozas ) 
        nev = getPlayerName ( source ) 
        addEventHandler ( "onClientRender", root, drawCsatlakozas ) 
        local sound = playSound ( "bip.wav" ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawCsatlakozas ) 
            end 
            ,5000, 1 
        ) 
    end 
) 
  
addEventHandler ( "onClientPlayerQuit", root, 
    function ( reason_ ) 
        removeEventHandler ( "onClientRender", root, drawKilepes ) 
        nev = getPlayerName ( source ) 
        reason = reasons [ reason_:lower ( ) ] 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound ( "bip.wav" ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawKilepes ) 
            end 
            ,5000, 1 
        ) 
    end 
) 

Link to comment
local x, y = guiGetScreenSize ( ) 
local nev = "" 
local reason = "" 
local reasons = 
    { 
        
        [ "unknown" ] = "Ismeretlen.", 
        [ "quit" ] = "Kilépett.", 
        [ "kicked" ] = "Kirúgva.", 
        [ "banned" ] = "Kitiltva.", 
        [ "bad connection" ] = "Rossz kapcsolat.", 
        [ "timed out" ] = "Idotúllépés.", 
        
    } 
  
  
function drawCsatlakozas ( ) 
    -- 1411, 228, 269, 84 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.08, tocolor(0, 0, 0, 125), true) 
    -- 1411, 312, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.297142, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    -- 1411, 228, 269, 21 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    -- 1425, 234, 1680, 244 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.380952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1455, 285, 1675, 302 
    dxDrawText("csatlakozott a szerverre.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
function drawKilepes( ) 
    -- 1411, 228, 269, 110 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.104761, tocolor(0, 0, 0, 125), true) 
    dxDrawRectangle(x*0.83988, 338, x*0.160119, y*0.02, tocolor(0, 0, 0, 185), true) 
    dxDrawRectangle(x*0.83988, y*0.217142, x*0.160119, y*0.02, tocolor(245, 140, 20, 200), true) 
    dxDrawText("Csatlakozás / Kilépés", x*0.848214, y*0.2228571, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1430, 453, 1680, 244 
    dxDrawText("CoreGaming", x*0.8511904, y*0.430952, x*1, y*0.23238, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, true, false, false) 
    -- 1465, 249, 1657, 280 
    dxDrawText(nev, x*0.872023, y*0.237142, x*0.985, y*0.266666, tocolor(255, 255, 255, 255), 1.15, "default-bold", "center", "center", false, false, true, false, false) 
    dxDrawText("lecsatlakozott a szerverrol.", x*0.8660714, y*0.271428, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
    -- 1455, 340, 1675, 302 
    dxDrawText("[ " .. tostring ( reason ) .." ]", x*0.866071, y*0.3238095, x*0.99702, y*0.28761, tocolor(255, 255, 255, 255), 1.10, "default", "center", "center", false, false, true, false, false) 
end 
  
addEventHandler ( "onClientPlayerJoin", root, 
    function ( ) 
        removeEventHandler ( "onClientRender", root, drawCsatlakozas ) 
        nev = getPlayerName ( source ) 
        addEventHandler ( "onClientRender", root, drawCsatlakozas ) 
        local sound = playSound ( "bip.wav" ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawCsatlakozas ) 
            end 
            ,5000, 1 
        ) 
    end 
) 
  
addEventHandler ( "onClientPlayerQuit", root, 
    function ( reason_ ) 
        removeEventHandler ( "onClientRender", root, drawKilepes ) 
        nev = getPlayerName ( source ) 
        reason = reasons [ reason_:lower ( ) ] 
        addEventHandler("onClientRender", root, drawKilepes) 
        local sound = playSound ( "bip.wav" ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, drawKilepes ) 
            end 
            ,5000, 1 
        ) 
    end 
) 

Oh, thank you, it works!! Thank you very much!

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