DRW Posted July 17, 2015 Share Posted July 17, 2015 I've created some GUI labels attached to an image for a mining system, and it works well, it takes the elementData of a player and it changes the respective label with the number of the elementData I want to retrieve. The problem starts when joining, all the labels in the script appear and some of them bother a lot. The essential part of the clientside script (Enough to know what happens since local screenW, screenH = guiGetScreenSize() interfven = guiCreateStaticImage(screenW - 192 - 10, (screenH - 111) / 2, 192, 111, ":imageretriever/zm.png", false) lab = guiCreateLabel(10, 10, 64, 15, "Ununtrium:", false, interfven) guiSetFont(lab, "default-bold-small") lab1 = guiCreateLabel(10, 25, 83, 15, "Ununquadium:", false, interfven) guiSetFont(lab1, "default-bold-small") lab2 = guiCreateLabel(10, 40, 83, 15, "Ununpentium:", false, interfven) guiSetFont(lab2, "default-bold-small") lab3 = guiCreateLabel(10, 55, 73, 15, "Ununhexium:", false, interfven) guiSetFont(lab3, "default-bold-small") lab4 = guiCreateLabel(10, 70, 78, 15, "Ununseptium:", false, interfven) guiSetFont(lab4, "default-bold-small") lab5 = guiCreateLabel(10, 85, 73, 16, "Ununoctium:", false, interfven) guiSetFont(lab5, "default-bold-small") uut = guiCreateLabel(83, 10, 64, 15, "uut", false, interfven) guiSetFont(uut, "default-bold-small") guiLabelSetColor(uut, 28, 255, 4) uuq = guiCreateLabel(99, 25, 83, 15, "uuq", false, interfven) guiSetFont(uuq, "default-bold-small") guiLabelSetColor(uuq, 181, 254, 4) uup = guiCreateLabel(99, 40, 83, 15, "uup", false, interfven) guiSetFont(uup, "default-bold-small") guiLabelSetColor(uup, 255, 198, 2) uuh = guiCreateLabel(89, 55, 73, 15, "uuh", false, interfven) guiSetFont(uuh, "default-bold-small") guiLabelSetColor(uuh, 255, 127, 1) uus = guiCreateLabel(93, 70, 73, 15, "uus", false, interfven) guiSetFont(uus, "default-bold-small") guiLabelSetColor(uus, 255, 48, 0) uuo = guiCreateLabel(89, 85, 73, 15, "uuo", false, interfven) guiSetFont(uuo, "default-bold-small") guiLabelSetColor(uuo, 255, 0, 0) addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()),function() engineReplaceCOL ( col_floors, 3924 ) engineImportTXD ( txd_floors, 3924 ) engineReplaceModel ( dff_floors, 3924) local ununt= getElementData (localPlayer, "ununtrium") local ununq=getElementData (localPlayer, "ununquadium") local ununp=getElementData (localPlayer, "ununpentium") local ununh=getElementData (localPlayer, "ununhexium") local ununs=getElementData (localPlayer, "ununseptium") local ununo=getElementData (localPlayer, "ununoctium") guiSetText (uut, ""..ununt.."") guiSetText (uuq, ""..ununq.."") guiSetText (uup, ""..ununp.."") guiSetText (uuh, ""..ununh.."") guiSetText (uus, ""..ununs.."") guiSetText (uuo, ""..ununo.."") setDevelopmentMode (true) guiSetVisible (label,false) guiSetVisible (label2,false) guiSetVisible (label3,false) guiSetVisible (interfven,false) end) attempt to concatenate local 'ununt' (a boolean value) What's wrong? Link to comment
lolman Posted July 17, 2015 Share Posted July 17, 2015 Ye, I had the same problem once, wtf is the problem and how to solve this?? Link to comment
myonlake Posted July 17, 2015 Share Posted July 17, 2015 (edited) This means "ununtrium" element data is not set, or if it is, it is set to a boolean value, which means you need to tostring( ) the guiSetText like so: guiSetText( uut, tostring( ununt ) ) And by the way, you don't need the quotes and stuff... just pass in the variable. "" .. ununt .. "" Edited July 17, 2015 by Guest Link to comment
DRW Posted July 17, 2015 Author Share Posted July 17, 2015 This means "ununtrium" element data is not set, or if it is, it is set to a boolean value, which means you need to tostring( ) the guiSetText like so: guiSetText( uut, tostring( ununt ) ) And by the way, you don't need the quotes and stuff... just pass in the variable and tostring( ) it instead. "" .. ununt .. "" Thank you very much! Link to comment
myonlake Posted July 17, 2015 Share Posted July 17, 2015 You're welcome. If you're still wondering why it's not returning anything other than a boolean (and it should be something else), then make sure the element data is set before the resource is started. In MTA 1.5 you can order the downloads so one resource starts before another one. Other than that, you could trigger a custom event client-side that will update the text after you have set the element data. Link to comment
DRW Posted July 17, 2015 Author Share Posted July 17, 2015 You're welcome.If you're still wondering why it's not returning anything other than a boolean (and it should be something else), then make sure the element data is set before the resource is started. In MTA 1.5 you can order the downloads so one resource starts before another one. Other than that, you could trigger a custom event client-side that will update the text after you have set the element data. Wow, really? How can I order downloads? Link to comment
myonlake Posted July 17, 2015 Share Posted July 17, 2015 Use the download_priority_group tag in your meta.xml file. Link to comment
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