Tete omar Posted October 13, 2012 Share Posted October 13, 2012 Hello there i've got a little question , and it's about , how do i get a number into " string.format " and put it on an empty label guiSetText(TEST,string.format("[ %d ]=TEST",10,"")) theEmptyLabel = guiCreateLabel(..,..,..,..,"",false,test) "TEST" is defined as a label. now number nine should be inside "theEmptyLabel" but not with the string, just the number alone. Link to comment
Castillo Posted October 13, 2012 Share Posted October 13, 2012 What you are saying doesn't really make much sense. Your code will only set the label text to that string, won't set the number apart. Maybe you should use element data instead, or a table. Link to comment
Tete omar Posted October 13, 2012 Author Share Posted October 13, 2012 What you are saying doesn't really make much sense.Your code will only set the label text to that string, won't set the number apart. Maybe you should use element data instead, or a table. isn't possible to use tonumber or something else ... ? cuz that number wouldn't be only and always 10, it'll be changed by the player on a different ways. Link to comment
Anderl Posted October 13, 2012 Share Posted October 13, 2012 What you are saying doesn't really make much sense.Your code will only set the label text to that string, won't set the number apart. Maybe you should use element data instead, or a table. isn't possible to use tonumber or something else ... ? cuz that number wouldn't be only and always 10, it'll be changed by the player on a different ways. Can you explain better everything? Link to comment
Tete omar Posted October 13, 2012 Author Share Posted October 13, 2012 What you are saying doesn't really make much sense.Your code will only set the label text to that string, won't set the number apart. Maybe you should use element data instead, or a table. isn't possible to use tonumber or something else ... ? cuz that number wouldn't be only and always 10, it'll be changed by the player on a different ways. Can you explain better everything? I'm just wanna get that number without that string which mixed with it , look guiSetText(TEST,string.format("[ %d ]=TEST",10,"")) > [10]=TEST if i wanna get or change or do math calculations or something else with that number , what should i do ? Link to comment
Anderl Posted October 13, 2012 Share Posted October 13, 2012 guiSetText(varLabel, string.format('[%d] = TEST', 10)) What is the problem? Link to comment
Tete omar Posted October 13, 2012 Author Share Posted October 13, 2012 guiSetText(varLabel, string.format('[%d] = TEST', 10)) What is the problem? It's too hard to explain ... , i'll do wat castillo told me. Link to comment
Anderl Posted October 13, 2012 Share Posted October 13, 2012 guiSetText(varLabel, string.format('[%d] = TEST', 10)) What is the problem? It's too hard to explain ... , i'll do wat castillo told me. Just explain how you know. Link to comment
Tete omar Posted October 13, 2012 Author Share Posted October 13, 2012 server function onLogin(_,account) local acc = getAccountData(account,"1_Time") if acc == "1" then return end triggerClientEvent(source,"forEveryNewPerson",source) end addEventHandler("onPlayerLogin",root,onLogin) function saveData(thePlayer,theAccount) if (theAccount and not isGuestAccount(theAccount)) then local data = getElementData(thePlayer,"1_Time") if data then setAccountData(theAccount,"1_Time",tostring(data)) end end end addEventHandler("onPlayerQuit",root,function()saveData(source,getPlayerAccount(source))end) addEventHandler("onPlayerLogout",root,function(prev)saveData(source,prev)end) client http://pastebin.com/GT5HMuxZ -- sorry the client side is confused with the website smiles. gs is defined as guiSetText metals = labels This is a project of metals script , i mean , everyone whose joins the server then give him 10 for each metal, the player can sell and buy, so if that player bought .. e.g , 5 golds , and here goes the math calculation, then provide 5 on 10 = 15 ofc , did you understand one word from wat i said lol ?. Link to comment
Castillo Posted October 13, 2012 Share Posted October 13, 2012 guiSetText(varLabel, string.format('[%d] = TEST', 10)) What is the problem? He wants to have that '10' as a number and the rest as a string, but such thing is not possible. Link to comment
Cadu12 Posted October 14, 2012 Share Posted October 14, 2012 The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument, whereas q and s expect a string. From wiki Lua. 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