Rat32 Posted May 8, 2015 Posted May 8, 2015 local dosyfa = "$500" syfik = tonumber(string.gsub(dosyfa, "%$", "", 1)) givePlayerMoney(client, tonumber(syfik)) Debugscript nothing. Gsub not working, any help?
WhoAmI Posted May 8, 2015 Posted May 8, 2015 local dosyfa = "$500" syfik = tonumber ( dosyfa:gsub ( "$", "" ) ) givePlayerMoney(client, tonumber(syfik) )
Rat32 Posted May 8, 2015 Author Posted May 8, 2015 'tonumber' #2 - base out of range - this error I have
WhoAmI Posted May 8, 2015 Posted May 8, 2015 outputChatBox ( dosyfa:gsub ( "$", "" ) ) Tell me what it outputs.
WhoAmI Posted May 8, 2015 Posted May 8, 2015 Oh I know what. string.gsub returns more than one value, so local dosyfa = "$500" syfik = dosyfa:gsub ( "$", "" ) givePlayerMoney(client, tonumber(syfik) )
WhoAmI Posted May 8, 2015 Posted May 8, 2015 local dosyfa = "$500" syfik = string.gsub ( dosyfa, "$", "" ) outputChatBox ( syfik ) givePlayerMoney(client, tonumber(syfik) )
Rat32 Posted May 8, 2015 Author Posted May 8, 2015 Same, but outputChatBox working, see "$500", but with "$"
WhoAmI Posted May 8, 2015 Posted May 8, 2015 local dosyfa = "$500" syfik = string.len ( dosyfa, 1, #dosyfa ) outputChatBox ( syfik ) givePlayerMoney(client, tonumber(syfik))
WhoAmI Posted May 8, 2015 Posted May 8, 2015 local dosyfa = "$500" syfik = string.gsub ( dosyfa, "%$", "", 1 ) givePlayerMoney ( client, tonumber ( syfik ) ) Works 100%.
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