papam77 Posted July 10, 2013 Share Posted July 10, 2013 function info() Name = guiCreateLabel(0.79, 0.01, 0.16, 0.04, "Name: "..getPlayerName( player ), true, background) guiSetFont(Name, "default-bold-small") guiLabelSetVerticalAlign(Name, "center") end Why i don't see it? What's wrong? Link to comment
papam77 Posted July 10, 2013 Author Share Posted July 10, 2013 So local player = getRootElement() ? Link to comment
myonlake Posted July 10, 2013 Share Posted July 10, 2013 Solocal player = getRootElement() ? Nope. Instead of 'player' use 'localPlayer'. Link to comment
papam77 Posted July 10, 2013 Author Share Posted July 10, 2013 function info(source) Name = guiCreateLabel(0.79, 0.01, 0.16, 0.04, "Name:" ..getPlayerName(localPlayer), true, background) guiSetFont(Name, "default-bold-small") guiLabelSetVerticalAlign(Name, "center") end But it doesn't write my name to the screen. Link to comment
PaiN^ Posted July 10, 2013 Share Posted July 10, 2013 Rmove "background" from the "guiCreateLabel" function . Link to comment
myonlake Posted July 10, 2013 Share Posted July 10, 2013 You have to trigger the function first. Where are you triggering the function? If nowhere, then type info() in the end of the file. Link to comment
papam77 Posted July 10, 2013 Author Share Posted July 10, 2013 addEvent ("lobby", true) function lobby() -- Effects local bg = playSound("sound/sea.mp3", true) setSoundVolume(bg, 1.0) setElementDimension(player,255 ) showCursor ( source, true) -- Design local background = { ["lobby"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true), ["sider"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/sider.png", true), } guiSetEnabled(background["lobby"],false) guiSetEnabled(background["sider"],false) --Text Name = guiCreateLabel(0.79, 0.01, 0.16, 0.04, "Name:" ..getPlayerName(localPlayer), true) guiSetFont(Name, "default-bold-small") guiLabelSetVerticalAlign(Name, "center") end addEventHandler("lobby", getRootElement(), lobby) Full Code. Images work correctly. Link to comment
denny199 Posted July 10, 2013 Share Posted July 10, 2013 Rofl, you are still trying to make a multi gamemode without succes. You should try to debug it Link to comment
فاّرس Posted July 10, 2013 Share Posted July 10, 2013 For get a name, guiSetText(Name,"Name"..getPlayerName(localPlayer)) and use : onClientRender for get a new name ( if change it ) and why you make table for backgrounds ? and player is not define and showCursoe(true) Link to comment
Jesseunit Posted July 10, 2013 Share Posted July 10, 2013 For get a name, guiSetText(Name,"Name"..getPlayerName(localPlayer)) and use : onClientRender for get a new name ( if change it ) and why you make table for backgrounds ? and player is not define. That way he can easily manage all the backgrounds, for example: Instead of using destroyElement/guiSetVisible on each static image he can easily delete all of the backgrounds with one single loop trough the table. Link to comment
myonlake Posted July 10, 2013 Share Posted July 10, 2013 (edited) Not sure what you really want with this code but here you go. Client-side local newname = "n/a" addEvent("lobby", true) addEventHandler("lobby", root, function() -- Effects sound = playSound("sound/sea.mp3", true) setSoundVolume(sound, 1.0) setElementDimension(localPlayer, 255) showCursor(true) -- Design background = { ["lobby"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true), ["sider"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/sider.png", true) } guiSetEnabled(background["lobby"], false) guiSetEnabled(background["sider"], false) -- Text name = guiCreateLabel(0.79, 0.01, 0.16, 0.04, "Name:" .. newname, true, background["lobby"]) guiSetFont(name, "default-bold-small") guiLabelSetVerticalAlign(name, "center") end ) addEventHandler("onClientRender", function() if (newname ~= getPlayerName(localPlayer)) then newname = getPlayerName(localPlayer) end end ) Edited July 10, 2013 by Guest Link to comment
papam77 Posted July 10, 2013 Author Share Posted July 10, 2013 myonlake: I don't see the text on the screen Link to comment
فاّرس Posted July 10, 2013 Share Posted July 10, 2013 (edited) addEventHandler("onClientRender",root, function() guiSetText(Name,'name : '..getPlayerName(localPlayer)) end ) Edited July 10, 2013 by Guest Link to comment
papam77 Posted July 10, 2013 Author Share Posted July 10, 2013 http://www.upload.ee/image/3437000/doesntwork.png Doesn't work. Link to comment
papam77 Posted July 10, 2013 Author Share Posted July 10, 2013 Ah i know where's the problem. Text is on the screen but under image. I have changed it: local player = getLocalPlayer() function multimode () showCursor ( true ) setFPSLimit ( source, 100 ) Name = guiCreateLabel(0.79, 0.01, 0.16, 0.04, "Name: "..getPlayerName( localPlayer ), true) guiSetFont(Name, "default-bold-small") guiLabelSetVerticalAlign(Name, "center") guiSetEnabled (Name, false ) local bg = { ["bg"] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true), } guiSetEnabled(bg["bg"],false) end addCommandHandler ("lobby", multimode ) How can add image under text? Link to comment
فاّرس Posted July 10, 2013 Share Posted July 10, 2013 Make the image and write the text. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now