Jump to content

Board on down of screen (sorry for bad english)


Recommended Posts

Posted

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.

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Posted

You are creating it EVERY RENDER, meaning you'll have around 500,000,000 elements created in a few minutes.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

Posted

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 :(?

Posted

Not found.... 1 error in debug in line 10 :

Nick[1] = guiCreateLabel(124,12,358,50,"Nick: "..tostring(player)"",false,Board[1]) 

DEBUG:

attempt to call a string value

Posted

Copy my script again.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Works here.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

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
Posted

Post your meta.xml content.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Not sure if this would fix much but do the following.

Instead of doing this;

"freshman.ttf" type="client" /> 

Do this;

"freshman.ttf" /> 

If I helped you, please click the like button on the right ;) Thanks!

Posted

Write: "/debugscript 3" on chatbox and look at the bottom of your screen, see what it outputs when you restart/start the script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

That doesn't make any sense, it works on my server.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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