MACIEKW89 Posted July 8, 2013 Posted July 8, 2013 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.
Castillo Posted July 8, 2013 Posted July 8, 2013 You are creating it EVERY RENDER, meaning you'll have around 500,000,000 elements created in a few minutes.
iPrestege Posted July 8, 2013 Posted July 8, 2013 Hi! Use : onClientResourceStart event to create gui element's and use : guiSetText To get player money..data ..etc .
Castillo Posted July 8, 2013 Posted July 8, 2013 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
MACIEKW89 Posted July 8, 2013 Author Posted July 8, 2013 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
iPrestege Posted July 8, 2013 Posted July 8, 2013 Castillo's code should work fine have you tried it?
MACIEKW89 Posted July 8, 2013 Author Posted July 8, 2013 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 ?
iPrestege Posted July 8, 2013 Posted July 8, 2013 You just ignore castillo's post and you ignore my post too can you care about our post please?
MACIEKW89 Posted July 9, 2013 Author Posted July 9, 2013 Sorry but he edit his post and i didn't saw it. Five minutes please. I try with castillo's code.
MACIEKW89 Posted July 9, 2013 Author Posted July 9, 2013 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
MACIEKW89 Posted July 9, 2013 Author Posted July 9, 2013 (edited) Not found and 0 errors... Edited July 9, 2013 by Guest
iPrestege Posted July 9, 2013 Posted July 9, 2013 Make sure it's client side . Post the fuck meta.xml file.
MACIEKW89 Posted July 9, 2013 Author Posted July 9, 2013 (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 July 9, 2013 by Guest
myonlake Posted July 10, 2013 Posted July 10, 2013 Not sure if this would fix much but do the following. Instead of doing this; "freshman.ttf" type="client" /> Do this; "freshman.ttf" />
Castillo Posted July 10, 2013 Posted July 10, 2013 Write: "/debugscript 3" on chatbox and look at the bottom of your screen, see what it outputs when you restart/start the script.
MACIEKW89 Posted July 10, 2013 Author Posted July 10, 2013 First i type /refreshall next /debugscript 3 and /start gracz (because it is my resource). Nothing in debug. Please help...
Castillo Posted July 10, 2013 Posted July 10, 2013 That doesn't make any sense, it works on my server.
MACIEKW89 Posted July 10, 2013 Author Posted July 10, 2013 (edited) Oh...mybye hosting problem? Can I do it on DX? We can help me? 10 minutes i do it... Edited July 10, 2013 by Guest
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