Jump to content

[Help] Questions


Stranger

Recommended Posts

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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...