Jump to content

Join with img don´t work.


lollipop

Recommended Posts

Hi, this is my second script. I wanna make a join quit with image, but, don´t work, idk why..Please help..

script_c.lua

addEvent ("join", true) 
function join () 
guiCreateStaticImage ( 0.7, 0.1, 0.2, 0.1, "bg.png" ) 
guiCreateLabel ( 0.7, 0.1, 0.2, 0.1, "Player"..getPlayerName"has joined the game." ) 
end 
addEventHandler("join", getRootElement(), join) 

script_s.lua

addEventHandler("onPlayerJoin", root, 
function() 
triggerClientEvent("join", getRootElement(), source) 
  
end) 

It´s only start...

Link to comment

Try this ;

-- # Client 
addEvent('g_Add',true) 
addEventHandler('g_Add',root, 
    function (  g_Name  ) 
        if isElement ( g_Image ) then destroyElement ( g_Image ) g_Image = nil end; 
        if isElement ( g_Label ) then destroyElement ( g_Label ) g_Label = nil end; 
                g_Image     =   guiCreateStaticImage ( 0.7, 0.1, 0.2, 0.1, "1.png",true ); 
                g_Label     =   guiCreateLabel ( 0.7, 0.1, 0.2, 0.1,'',true ); 
                guiSetText ( g_Label,'Player '..g_Name..' Has joined the game.' ); 
        end 
); 

-- # Server 
addEventHandler('onPlayerJoin',root, 
    function (      ) 
        triggerClientEvent ( 'g_Add',root,getPlayerName (   source  )   ); 
    end 
); 

Link to comment

Look at the examples in the Wiki and try them out. It's rather simple after all. I didn't know crap about it myself either back some years ago and now it goes like liquid. Go and try and let us know if something's not right. Don't be afraid of trying out new stuff - otherwise you will always stay at that level of experience ;)

Link to comment

Omg, i dont know create dxDrawText....I´m only beginner in scripting...and your script is in heavier shape...

addEvent('g_Add',true) 
addEventHandler('g_Add',root, 
    function (  g_Name  ) 
        if isElement ( g_Image ) then destroyElement ( g_Image ) g_Image = nil end; 
        if isElement ( g_Label ) then destroyElement ( g_Label ) g_Label = nil end; 
                g_Image     =   guiCreateStaticImage ( 0.8, 0.0, 0.3, 0.03, "bg.png",true ); 
                g_Label     =   dxDrawText("Player"...getPlayerName" has joined the game.", 20, 247, 792, 329, tocolor(15, 217, 0, 255), 5.00, "default-bold", "left", "top", false, false, true, false, 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...