Jump to content

Join Failed


luck.

Recommended Posts

hi all

good, I own a joinquit that has 4 functions: join, quit, login, nick, most just quit and nick work, can someone help me?

code:

function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) 
    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 ) 
            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, left, top, clip, wordbreak, postGUI ) 
    end 
end 
  
local messageJoin = "" 
local messageQuit = "" 
local messageNick = "" 
local messageLogin = "" 
x,y = guiGetScreenSize() 
local scaleX = x/1920 
local scaleY = y/1080 
  
function renderPlayerJoined ( ) 
    dxDrawColorText("#ffffff".. messageJoin, 1140*scaleX, 20,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 20,16,16,"icon/join.png",0,-120) 
end 
function renderPlayerLeft ( ) 
    dxDrawColorText("#ffffff".. messageQuit, 1140*scaleX, 40,573.0,32.0,tocolor(0,0,255,170),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 40,16,16,"icon/quit.png",0,-120) 
end 
function renderPlayerNick ( ) 
    dxDrawColorText("#ffffff".. messageNick, 1140*scaleX, 60,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 60,16,16,"icon/nick.png",0,-120) 
end 
function renderPlayerLogin ( ) 
    dxDrawColorText("#ffffff".. messageLogin, 1140*scaleX, 80,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 80,16,16,"icon/login.png",0,-120) 
end 
  
function greetingHandler ( player, ulke ) 
    messageJoin = "#ffffff"..getPlayerName (player) .. " #ffffffhas joined the game from #00ff00 ".. tostring ( ulke ) .."" 
    addEventHandler ( "onClientRender", root, renderPlayerJoined ) 
    setTimer ( 
        function ( ) 
            removeEventHandler ( "onClientRender", root, renderPlayerJoined ) 
        end 
        ,6000,1 
    ) 
end 
addEvent( "onJoin", true ) 
addEventHandler( "onJoin", root, greetingHandler ) 
  
addEventHandler('onClientPlayerQuit', root, 
    function(reason) 
        messageQuit  = "#ffffff" ..getPlayerName(source) .. " #ffffffhas left game. [#ffffff" .. reason .. "#ffffff]" 
        addEventHandler ( "onClientRender", root, renderPlayerLeft ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, renderPlayerLeft ) 
            end 
            ,6000,1 
        ) 
    end 
) 
  
addEventHandler ( "onClientPlayerChangeNick", root, 
    function ( oldNick, newNick ) 
        messageNick = "#ffffff" ..oldNick.. " #ffffffis now known as #ffffff" ..newNick 
        addEventHandler ( "onClientRender", root, renderPlayerNick ) 
        setTimer ( 
            function ( ) 
                removeEventHandler ( "onClientRender", root, renderPlayerNick ) 
            end 
            ,6000,1 
        ) 
    end 
) 
  
function giris ( player ) 
    messageLogin = "#ffffff"..getPlayerName (player) .. " #ffffffhas successfully logged in!" 
    addEventHandler ( "onClientRender", root, renderPlayerLogin ) 
    setTimer ( 
        function ( ) 
            removeEventHandler ( "onClientRender", root, renderPlayerLogin ) 
        end 
        ,6000,1 
    ) 
end 
addEvent( "onPlayerLogin", true ) 
addEventHandler( "onLogin", root, giris ) 
  
function cikis ( player ) 
    messageLogin = "#ffffff"..getPlayerName (player) .. " #ffffffhas successfully logged out!" 
    addEventHandler ( "onClientRender", root, renderPlayerLogin ) 
    setTimer ( 
        function ( ) 
            removeEventHandler ( "onClientRender", root, renderPlayerLogin ) 
        end 
        ,6000,1 
    ) 
end 
addEvent( "onPlayerLogout", true ) 
addEventHandler( "onLogout", root, cikis ) 
  

Link to comment

try this:

function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) 
    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 ) 
            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, left, top, clip, wordbreak, postGUI ) 
    end 
end 
  
local message = {join="",quit="",nick="",login=""} 
local x,y = guiGetScreenSize() 
local scaleX = x/1920 
local scaleY = y/1080 
  
function renderPlayerJoined ( ) 
    dxDrawColorText("#ffffff".. message.join, 1140*scaleX, 20,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 20,16,16,"icon/join.png",0,-120) 
end 
function renderPlayerLeft ( ) 
    dxDrawColorText("#ffffff".. message.quit, 1140*scaleX, 40,573.0,32.0,tocolor(0,0,255,170),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 40,16,16,"icon/quit.png",0,-120) 
end 
function renderPlayerNick ( ) 
    dxDrawColorText("#ffffff".. message.nick, 1140*scaleX, 60,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 60,16,16,"icon/nick.png",0,-120) 
end 
function renderPlayerLogin ( ) 
    dxDrawColorText("#ffffff".. message.login, 1140*scaleX, 80,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 80,16,16,"icon/login.png",0,-120) 
end 
  
  
addEvent( "onJoin", true ) 
addEventHandler( "onJoin", root,function( player, ulke ) 
    message.join = "#ffffff"..getPlayerName (player) .. " #ffffffhas joined the game from #00ff00 ".. tostring ( ulke ) 
    addEventHandler ( "onClientRender", root, renderPlayerJoined ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerJoined ) 
end) 
  
addEventHandler('onClientPlayerQuit', root,function(reason) 
    message.quit  = "#ffffff" ..getPlayerName(source) .. " #ffffffhas left game. [#ffffff" .. reason .. "#ffffff]" 
    addEventHandler ( "onClientRender", root, renderPlayerLeft ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerLeft ) 
end) 
  
addEventHandler ( "onClientPlayerChangeNick", root,function ( oldNick, newNick ) 
    message.nick = "#ffffff" ..oldNick.. " #ffffffis now known as #ffffff" ..newNick 
    addEventHandler ( "onClientRender", root, renderPlayerNick ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerNick ) 
end) 
  
addEvent( "onPlayerLogin", true ) 
addEvent( "onPlayerLogout", true ) 
  
addEventHandler( "onPlayerLogin", root, function( player ) 
    message.login = "#ffffff"..getPlayerName (player) .. " #ffffffhas successfully logged in!" 
    addEventHandler ( "onClientRender", root, renderPlayerLogin ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerLogin ) 
end) 
  
addEventHandler( "onPlayerLogout", root, function( player ) 
    message.login = "#ffffff"..getPlayerName (player) .. " #ffffffhas successfully logged out!" 
    addEventHandler ( "onClientRender", root, renderPlayerLogin ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerLogin ) 
end) 

And where is "onJoin" triggered?

Link to comment
And where is "onJoin" triggered?

sorry, do not know English very well, anyway substitutes "onPlayerJoin" even so messages Join Login and still do not work, now the messages are also frozen on the screen, I can not know what is wrong because the console shows no nothing.

function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) 
    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 ) 
            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, left, top, clip, wordbreak, postGUI ) 
    end 
end 
  
local message = {join="",quit="",nick="",login=""} 
local x,y = guiGetScreenSize() 
local scaleX = x/1920 
local scaleY = y/1080 
  
function renderPlayerJoined ( ) 
    dxDrawColorText("#ffffff".. message.join, 1140*scaleX, 20,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 20,16,16,"icon/join.png",0,-120) 
end 
function renderPlayerLeft ( ) 
    dxDrawColorText("#ffffff".. message.quit, 1140*scaleX, 40,573.0,32.0,tocolor(0,0,255,170),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 40,16,16,"icon/quit.png",0,-120) 
end 
function renderPlayerNick ( ) 
    dxDrawColorText("#ffffff".. message.nick, 1140*scaleX, 60,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 60,16,16,"icon/nick.png",0,-120) 
end 
function renderPlayerLogin ( ) 
    dxDrawColorText("#ffffff".. message.login, 1140*scaleX, 80,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (1110*scaleX, 80,16,16,"icon/login.png",0,-120) 
end 
  
  
addEvent( "onPlayerJoin", true ) 
addEventHandler( "onPlayerJoin", root,function( player, ulke ) 
    message.join = "#ffffff"..getPlayerName (player) .. " #ffffffhas joined the game from #00ff00 ".. tostring ( ulke ) 
    addEventHandler ( "onClientRender", root, renderPlayerJoined ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerJoined ) 
end) 
  
addEventHandler('onClientPlayerQuit', root,function(reason) 
    message.quit  = "#ffffff" ..getPlayerName(source) .. " #ffffffhas left game. [#ffffff" .. reason .. "#ffffff]" 
    addEventHandler ( "onClientRender", root, renderPlayerLeft ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerLeft ) 
end) 
  
addEventHandler ( "onClientPlayerChangeNick", root,function ( oldNick, newNick ) 
    message.nick = "#ffffff" ..oldNick.. " #ffffffis now known as #ffffff" ..newNick 
    addEventHandler ( "onClientRender", root, renderPlayerNick ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerNick ) 
end) 
  
addEvent( "onPlayerLogin", true ) 
addEvent( "onPlayerLogout", true ) 
  
addEventHandler( "onPlayerLogin", root, function( player ) 
    message.login = "#ffffff"..getPlayerName (player) .. " #ffffffhas successfully logged in!" 
    addEventHandler ( "onClientRender", root, renderPlayerLogin ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerLogin ) 
end) 
  
addEventHandler( "onPlayerLogout", root, function( player ) 
    message.login = "#ffffff"..getPlayerName (player) .. " #ffffffhas successfully logged out!" 
    addEventHandler ( "onClientRender", root, renderPlayerLogin ) 
    setTimer(removeEventHandler,6000,1,"onClientRender", root, renderPlayerLogin ) 
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...