#RooTs Posted September 26, 2014 Share Posted September 26, 2014 (edited) is no longer working? local money = convertNumber(getPlayerMoney(localPlayer)) --money format 1,000,000,0 dxDrawBorderedText("R$: "..money, x*0.875, y*0.155, x*800, y*030, tocolor(255, 255, 255,255), 1.7, "default", "left", "top", false, false, true, false, false) Edited September 27, 2014 by Guest Link to comment
Banex Posted September 26, 2014 Share Posted September 26, 2014 (edited) convertNumber is not a native function of the MTA, then you need to add this function in your script function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end Edited September 26, 2014 by Guest Link to comment
#DRAGON!FIRE Posted September 26, 2014 Share Posted September 26, 2014 or use tonumber -,- u add convertNumber function in your script ? Link to comment
#RooTs Posted September 26, 2014 Author Share Posted September 26, 2014 always used this function in mta 1.3, has another easier way to do it in mta 1.4 ?? local money = convertNumber(getPlayerMoney(localPlayer)) Link to comment
Castillo Posted September 26, 2014 Share Posted September 26, 2014 No, MTA has no default function to do this, and is not required either. Link to comment
#DRAGON!FIRE Posted September 27, 2014 Share Posted September 27, 2014 u must add convertNumber function in your script this is not a function from mta https://wiki.multitheftauto.com/wiki/ConvertNumber Link to comment
#RooTs Posted September 27, 2014 Author Share Posted September 27, 2014 No, MTA has no default function to do this, and is not required either. @Castilho, I had this function, and because it no longer works? ( because it became so complicated? ) local money = convertNumber(getPlayerMoney(localPlayer)) makes no sense why she no longer works Link to comment
Banex Posted September 27, 2014 Share Posted September 27, 2014 as I said before, it is not a standard function of the MTA you need to put the code in your script. Otherwise it will not work Link to comment
#RooTs Posted September 27, 2014 Author Share Posted September 27, 2014 as I said before, it is not a standard function of the MTA you need to put the code in your script. Otherwise it will not work do not know WHAT is talking, looks the Solidsnake14 spoke, No, MTA has no default function to do this, and is not required either. Link to comment
Banex Posted September 27, 2014 Share Posted September 27, 2014 do not know WHAT is talking, looks the Solidsnake14 spoke, LekRoots I did not understand what you said Castillo said that this function is not standard MTA and I did not say anything contrary to what he said ... https://wiki.multitheftauto.com/wiki/Useful_Functions This page lists user-made Lua functions that are not included by default in MTA. Its purpose is to quickly provide some useful functions for scripters, so they do not waste time recreating them when needed. Link to comment
King12 Posted September 27, 2014 Share Posted September 27, 2014 What's the difference between convertNumber and tonumber? an example for tonumber : https://wiki.multitheftauto.com/wiki/SetPlayerMoney Link to comment
Banex Posted September 27, 2014 Share Posted September 27, 2014 What's the difference between convertNumber and tonumber? an example for tonumber : https://wiki.multitheftauto.com/wiki/SetPlayerMoney convertNumber and tonumber bears no resemblance ConverteNumber will show the number with commas, for example: 1,000,000 In this example the wiki, tonumber will be the number you want to set your Money, example: / setcash 1000000 If you are asking this because of the lcd1232 reply, he is wrong, it is not necessary to use tonumber because getPlayerMoney already generates a number Link to comment
#RooTs Posted September 27, 2014 Author Share Posted September 27, 2014 this also does not work unfortunately my problem will not be clarified @Banex, tests the formula on your local server, and show me the result, please local pMoney = getPlayerMoney(getLocalPlayer()) local convertedMoney = convertNumber(pMoney) Link to comment
UnG//Macaus Posted September 27, 2014 Share Posted September 27, 2014 Errors in debugscript? Link to comment
#RooTs Posted September 27, 2014 Author Share Posted September 27, 2014 Errors in debugscript? there are no errors Link to comment
Banex Posted September 27, 2014 Share Posted September 27, 2014 I repeat, convertNumber is not a function of the MTA convertNumber is a function created by any one person, she has no connection with the MTA So it will not work if you do not add the code to your script !!! if you do not put the code in your script, you will have no result https://wiki.multitheftauto.com/wiki/ConvertNumber @Edit I tested it and it works normally you just need to add the convertNumber function in your script. Can not you understand that? Link to comment
#RooTs Posted September 27, 2014 Author Share Posted September 27, 2014 LOLLSSS I'm already thinking that my mta is in trouble function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end local money = formatted -- what to put here? I've tried ( number, formatted, k ) dxDrawText("R$: "..money, x*0.835, y*0.150, x*800, y*030, tocolor(255, 255, 255,255), 0.7, "bankgothic", "left", "top", false, false, true, false, false) Link to comment
DNL291 Posted September 27, 2014 Share Posted September 27, 2014 dxDrawText("R$: "..convertNumber(money), x*0.835, y*0.150, x*800, y*030, tocolor(255, 255, 255,255), 0.7, "bankgothic", "left", "top", false, false, true, false, false) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end P.S: 'money' must be defined. Link to comment
#RooTs Posted September 27, 2014 Author Share Posted September 27, 2014 dxDrawText("R$: "..convertNumber(money), x*0.835, y*0.150, x*800, y*030, tocolor(255, 255, 255,255), 0.7, "bankgothic", "left", "top", false, false, true, false, false) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if ( k==0 ) then break end end return formatted end P.S: 'money' must be defined. WORKING....... my MTA really was in trouble SORRY MY FRIENDS, thanks all, by patience with me 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