Rat32 Posted May 8, 2015 Share Posted May 8, 2015 local dosyfa = "$500" syfik = tonumber(string.gsub(dosyfa, "%$", "", 1)) givePlayerMoney(client, tonumber(syfik)) Debugscript nothing. Gsub not working, any help? Link to comment
WhoAmI Posted May 8, 2015 Share Posted May 8, 2015 local dosyfa = "$500" syfik = tonumber ( dosyfa:gsub ( "$", "" ) ) givePlayerMoney(client, tonumber(syfik) ) Link to comment
Rat32 Posted May 8, 2015 Author Share Posted May 8, 2015 'tonumber' #2 - base out of range - this error I have Link to comment
WhoAmI Posted May 8, 2015 Share Posted May 8, 2015 outputChatBox ( dosyfa:gsub ( "$", "" ) ) Tell me what it outputs. Link to comment
WhoAmI Posted May 8, 2015 Share 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) ) Link to comment
Rat32 Posted May 8, 2015 Author Share Posted May 8, 2015 Nothing, "base out of range" in the debugscript. Link to comment
Rat32 Posted May 8, 2015 Author Share Posted May 8, 2015 Now, "getPlayerMoney" at arg2 got nil Link to comment
WhoAmI Posted May 8, 2015 Share Posted May 8, 2015 local dosyfa = "$500" syfik = string.gsub ( dosyfa, "$", "" ) outputChatBox ( syfik ) givePlayerMoney(client, tonumber(syfik) ) Link to comment
Rat32 Posted May 8, 2015 Author Share Posted May 8, 2015 Same, but outputChatBox working, see "$500", but with "$" Link to comment
WhoAmI Posted May 8, 2015 Share Posted May 8, 2015 local dosyfa = "$500" syfik = string.len ( dosyfa, 1, #dosyfa ) outputChatBox ( syfik ) givePlayerMoney(client, tonumber(syfik)) Link to comment
Rat32 Posted May 8, 2015 Author Share Posted May 8, 2015 Work, but give me only 2 dollars Link to comment
WhoAmI Posted May 8, 2015 Share Posted May 8, 2015 local dosyfa = "$500" syfik = string.gsub ( dosyfa, "%$", "", 1 ) givePlayerMoney ( client, tonumber ( syfik ) ) Works 100%. 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