Jump to content

Board on down of screen (sorry for bad english)


Recommended Posts

Hello!

I have a problem with my script. I wonna create a board on down of screen (Nick, Score & Money)...not work. I create a board in gui (image) with labels...not work. 0 errors in debug.

font= guiCreateFont("freshman.ttf", 12) 
  
local player = getPlayerName(getLocalPlayer()) 
  
addEventHandler("onClientRender",resourceRoot, 
    function() 
        
        Board = {} 
        Nick = {} 
        Score = {} 
        Money = {} 
        
        Board[1] = guiCreateStaticImage(0,0.9385,0.9992,0.0605,"belka_dolna.png",false) 
        Nick[1] = guiCreateLabel(124,12,358,50,"Nick: "..tostring(player)"",false,Board[1]) 
        guiSetFont(Nick[1],"font") 
        Score[1] = guiCreateLabel(472,12,358,50,"Score: "..getElementData("Score")"",false,Board[1]) 
        guiSetFont(Score[1],"font") 
        Money[1] = guiCreateLabel(802,12,477,50,"Money: "..getPlayerMoney()" $",false,Board[1]) 
        guiSetFont(Money[1],"font") 
end) 

Please help.

Link to comment
  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        font = guiCreateFont ( "freshman.ttf", 12 ) 
        Board = {} 
        Nick = {} 
        Score = {} 
        Money = {} 
  
        Board[1] = guiCreateStaticImage(0,0.9385,0.9992,0.0605,"belka_dolna.png",false) 
        Nick[1] = guiCreateLabel(124,12,358,50,"",false,Board[1]) 
        guiSetFont(Nick[1],font) 
        Score[1] = guiCreateLabel(472,12,358,50,"",false,Board[1]) 
        guiSetFont(Score[1],font) 
        Money[1] = guiCreateLabel(802,12,477,50,"",false,Board[1]) 
        guiSetFont(Money[1],font) 
  
        addEventHandler ( "onClientRender", root, render ) 
    end 
) 
  
  
function render ( ) 
    guiSetText ( Nick [ 1 ], "Nick: ".. getPlayerName ( localPlayer ) ) 
    guiSetText ( Score [ 1 ], "Score: ".. tostring ( getElementData ( localPlayer, "Score" ) ) ) 
    guiSetText ( Money [ 1 ], "Money: $".. getPlayerMoney ( ) ) 
end 

Link to comment

Not work :(

addEventHandler('onClientPreRender',root, 
    function (  ) 
        guiSetText ( Nick[1],'Nick : '..player ) 
        guiSetText ( Score[1],'Score : '..getElementData ( localPlayer,'Score' ) ) 
        guiSetText ( Money[1],'Money : '..getPlayerMoney ( )..' $') 
    end 
) 

In here is a error

Link to comment

With my friend help i have this code :

local czcionka = guiCreateFont("freshman.ttf", 12) 
local player1 = getLocalPlayer() 
Belka = {} 
Nick = {} 
Score = {} 
Pieniadze = {} 
  
  
    Belka[1] = guiCreateStaticImage(0,0.9385,0.9992,0.0605,"belka_dolna.png",false) 
    Nick[1] = guiCreateLabel(124,12,358,50,"",false,Belka[1]) 
    guiSetFont( Nick[1],czcionka ) 
    Score[1] = guiCreateLabel(472,12,358,50,"Score: ",false,Belka[1]) 
    guiSetFont( Score[1],czcionka ) 
    Pieniadze[1] = guiCreateLabel(802,12,477,50,"Pieniadze: $",false,Belka[1]) 
    guiSetFont( Pieniadze[1],czcionka ) 
  
  
  
function set1() 
    local gracz = getPlayerName ( player1 ) 
    local score = getElementData ( localPlayer,"Score" ) 
    local kasa = getPlayerMoney ( player1 ) 
    guiSetText ( Nick[1],"Nick: "..gracz.."") 
    guiSetText ( Score[1],"Score: "..score.."" ) 
    guiSetText ( Pieniadze[1],"Pieniadze: "..kasa.." $") 
 end 
 addEventHandler ( "onClientRender", getRootElement(), set1 ) 

Not work...what's wrong :(?

Link to comment

Why it not work on my server?

Meta :

<meta> 
    <info author="MACIEKW89" version="1.0" type="script" name="Belka" description="Belka na dole ekranu....takie info o graczu..." /> 
  
    <file src="belka_dolna.png" /> 
    <file src="freshman.ttf" type="client" /> 
    <script src="gracz_info_c.lua" type="client" /> 
</meta> 

It is in Polish.

Edited by Guest
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...