papam77 Posted July 10, 2013 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?
MIKI785 Posted July 10, 2013 Posted July 10, 2013 player's not defined. Lua Scripter Owner of mshost.cz MTA portal.
myonlake Posted July 10, 2013 Posted July 10, 2013 Solocal player = getRootElement() ? Nope. Instead of 'player' use 'localPlayer'. If I helped you, please click the like button on the right Thanks!
papam77 Posted July 10, 2013 Author 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.
PaiN^ Posted July 10, 2013 Posted July 10, 2013 Rmove "background" from the "guiCreateLabel" function . " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
myonlake Posted July 10, 2013 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. If I helped you, please click the like button on the right Thanks!
papam77 Posted July 10, 2013 Author 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.
denny199 Posted July 10, 2013 Posted July 10, 2013 Rofl, you are still trying to make a multi gamemode without succes. You should try to debug it Sometimes I dream about cheese
فاّرس Posted July 10, 2013 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) Sha67 سابقاً
Jesseunit Posted July 10, 2013 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.
myonlake Posted July 10, 2013 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 If I helped you, please click the like button on the right Thanks!
papam77 Posted July 10, 2013 Author Posted July 10, 2013 myonlake: I don't see the text on the screen
فاّرس Posted July 10, 2013 Posted July 10, 2013 (edited) addEventHandler("onClientRender",root, function() guiSetText(Name,'name : '..getPlayerName(localPlayer)) end ) Edited July 10, 2013 by Guest Sha67 سابقاً
papam77 Posted July 10, 2013 Author Posted July 10, 2013 http://www.upload.ee/image/3437000/doesntwork.png Doesn't work.
papam77 Posted July 10, 2013 Author 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?
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