Jump to content

I don't see text on the screen...why?


papam77

Recommended Posts

Posted
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?

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

Posted

You have to trigger the function first. Where are you triggering the function? If nowhere, then type info() in the end of the file.

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

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

Posted (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 by Guest
Posted

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?

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