Stranger Posted October 1, 2013 Share Posted October 1, 2013 hello guys i have problem with this code : function qaw() que = { "Question" , } ans = { "answer" , } ranque = math.random(1,19) outputChatBox("#ff0000The Question Says: "..que[ranque].." " ,getRootElement(),255,255,0,true) coans = ans[ranque] end setTimer(qaw,50,1) setTimer(qaw,120000,0) function playerchatqaw ( msg, msgty ) if coans then if msg == coans then won = givePlayerMoney(source,math.random(1000,3000) outputChatBox(..coans.." Congratulation's " .. getPlayerName(source) .. " You won #00ff00$".. won .." ",getRootElement(),255,255,0,true) coans = nil end end end addEventHandler ("onPlayerChat",getRootElement(),playerchatqaw) the problem is the "Question" is not showing , i don't know what is the problem, i tried to fix it but nothing happens Link to comment
Castillo Posted October 1, 2013 Share Posted October 1, 2013 You have a missing parentheses at this line: won = givePlayerMoney(source,math.random(1000,3000) Should be: won = givePlayerMoney ( source, math.random ( 1000, 3000 ) ) Link to comment
Stranger Posted October 1, 2013 Author Share Posted October 1, 2013 You have a missing parentheses at this line: won = givePlayerMoney(source,math.random(1000,3000) Should be: won = givePlayerMoney ( source, math.random ( 1000, 3000 ) ) Thank you and i was have problem in the line 88 Edit : and i have probelm, the debug says : ERROR: xFuny/Funny.lua:88: attempt to concatenate global 'won' (a boolean value) Link to comment
Castillo Posted October 1, 2013 Share Posted October 1, 2013 That's because givePlayerMoney returns a boolean: if the money was successfully given, it returns true, false otherwise. Link to comment
Stranger Posted October 1, 2013 Author Share Posted October 1, 2013 That's because givePlayerMoney returns a boolean: if the money was successfully given, it returns true, false otherwise. Hmm.. Sorry but where can i put " return true" ? or do you mean like that : if won then return true Link to comment
Castillo Posted October 1, 2013 Share Posted October 1, 2013 Do this instead: local won = math.random ( 1000, 3000 ) givePlayerMoney ( source, won ) Link to comment
Stranger Posted October 1, 2013 Author Share Posted October 1, 2013 Do this instead: local won = math.random ( 1000, 3000 ) givePlayerMoney ( source, won ) Thank you so much !! 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