Tete omar Posted October 13, 2012 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.
Castillo Posted October 13, 2012 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.
Tete omar Posted October 13, 2012 Author 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.
Anderl Posted October 13, 2012 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?
Tete omar Posted October 13, 2012 Author 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 ?
Anderl Posted October 13, 2012 Posted October 13, 2012 guiSetText(varLabel, string.format('[%d] = TEST', 10)) What is the problem?
Tete omar Posted October 13, 2012 Author 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.
Anderl Posted October 13, 2012 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.
Tete omar Posted October 13, 2012 Author 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 ?.
Castillo Posted October 13, 2012 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.
Cadu12 Posted October 14, 2012 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.
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