Jump to content

Join with img don´t work.


lollipop

Recommended Posts

Posted

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

Posted

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 
); 

Posted

I'm do not know the wrong ,,

But try this with code iFahad,

addEventHandler('onPlayerJoin',root, 
    function (      ) 
        triggerClientEvent (root,'g_Add',root,getPlayerName (   source  )   ); 
    end 
); 
Posted
Still nothing........

You know that it will only show for all players except for the player that joined right? so you need at least two players to test it.

Posted
Still nothing........

You know that it will only show for all players except for the player that joined right? so you need at least two players to test it.

No, because it dont have timer O_O

Posted
Make sure you changed the path '1.png' to 'bg.png' in the client side + post the meta with code.

Yea, i changed it...

meta:

>author="noxes" type="script" /> ="script_c.lua" type="client" />="script_s.lua" type="server" /> >

Posted

And....How i can create "guiCreateLabel" with color ?...I mean...Now it is: Player #ffffffXXX has joined the game. And i want only Player XXX(white color) has joined the game. Can i this ?

Posted
Ah... xD ..... Now i have: Player #ff0000NoXe has joined the game. I want: Player NoXe has joined the game.

You can't use hex colors with label color do it using :

dxDrawText 

+

onClientRender To draw the text ;)!

Ou, i dont know work with dx >.< :-(

Posted

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 ;)

Posted

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 
); 

Posted

"Heavier shape" - WTF? :D

Anyway, that's because dxDrawText is rendered just for one frame, so it's impossible to see it for one frame... that's why you're supposed to use onClientRender or preRender to show it continuously, refer to wiki.

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