Jump to content

[HELP] JoinQuit


Reflex#

Recommended Posts

I have my joinquit script and i wanna add the image left from text

How can i make it?

I forgot..

   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 = "" 
      
    function renderPlayerJoined ( ) 
        dxDrawColorText("Server: ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(255,255,255,255),0.7,"sans","left","top",false,false,false) 
    end 
      
    function renderPlayerLeft ( ) 
        dxDrawColorText("Server: ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(255,255,255,255),0.7,"sans","left","top",false,false,false) 
    end 
      
    addEventHandler('onClientPlayerJoin', root, 
        function() 
            messageJoin = getPlayerName(source) .. " #ffffffhas joined the game" 
            addEventHandler ( "onClientRender", root, renderPlayerJoined ) 
            setTimer ( 
                function ( ) 
                    removeEventHandler ( "onClientRender", root, renderPlayerJoined ) 
                end 
                ,6000,1 
            ) 
        end 
    )      
    addEventHandler('onClientPlayerQuit', root, 
        function(reason) 
            messageQuit  = getPlayerName(source) .. " #ffffffhas left the game [" .. reason .. "]" 
            addEventHandler ( "onClientRender", root, renderPlayerLeft ) 
            setTimer ( 
                function ( ) 
                    removeEventHandler ( "onClientRender", root, renderPlayerLeft ) 
                end 
                ,6000,1 
            ) 
        end 
    ) 

Link to comment
[lua]   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 = "" 
      
    function renderPlayerJoined ( ) 
dxDrawImage ( screenWidth/2 - 503.0, 4.0, 574.0, 20.0, 'join.png', angle, 0, -120 ) 
        dxDrawColorText("Server: ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(255,255,255,255),0.7,"sans","left","top",false,false,false) 
    end 
      
    function renderPlayerLeft ( ) 
        dxDrawColorText("Server: ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(255,255,255,255),0.7,"sans","left","top",false,false,false) 
    end 
      
    addEventHandler('onClientPlayerJoin', root, 
        function() 
            messageJoin = getPlayerName(source) .. " #ffffffhas joined the game" 
            addEventHandler ( "onClientRender", root, renderPlayerJoined ) 
            setTimer ( 
                function ( ) 
                    removeEventHandler ( "onClientRender", root, renderPlayerJoined ) 
                end 
                ,6000,1 
            ) 
        end 
    )      
    addEventHandler('onClientPlayerQuit', root, 
        function(reason) 
            messageQuit  = getPlayerName(source) .. " #ffffffhas left the game [" .. reason .. "]" 
            addEventHandler ( "onClientRender", root, renderPlayerLeft ) 
            setTimer ( 
                function ( ) 
                    removeEventHandler ( "onClientRender", root, renderPlayerLeft ) 
                end 
                ,6000,1 
            ) 
        end 
    ) 

I add in 28 line..

i forgot dxdrawImage func

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