Jump to content

JoinQuit.


matito6

Recommended Posts

Posted

Hello . I have one problem with joinquit of lua. Only don't work Join script idk why ? someone can fix it ? . Thanks .

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() 
  
function renderPlayerJoined ( ) 
    dxDrawColorText("#ffffff".. messageJoin,30,y/2-20,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (10,y/2-20,16,16,"icon/join.png",0,-120) 
end 
function renderPlayerLeft ( ) 
    dxDrawColorText("#ffffff".. messageQuit,30,y/2,573.0,32.0,tocolor(0,0,255,170),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (10,y/2,16,16,"icon/quit.png",0,-120) 
end 
function renderPlayerNick ( ) 
    dxDrawColorText("#ffffff".. messageNick,30,y/2+20,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (10,y/2+20,16,16,"icon/nick.png",0,-120) 
end 
function renderPlayerLogin ( ) 
    dxDrawColorText("#ffffff".. messageLogin,30,y/2+40,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) 
    dxDrawImage (10,y/2+40,16,16,"icon/login.png",0,-120) 
end 
  
function greetingHandler ( player, ulke ) 
    messageJoin = "#ffffff"..getPlayerName (player) .. " #ffffffhas joined the game from #ffffff".. 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( "onLogin", 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( "onLogout", true ) 
addEventHandler( "onLogout", root, cikis ) 
  

Posted

Show us the server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Where did you get that script from? because it has missing server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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