Jump to content

My Math Problem Script Doesn't Work !


Recommended Posts

Hi Guys ,,

I Have Problem in My script ,,

it show random math problem Every 5 Sec ,,

and players can answer by chat

but the script doesn't work :(

i don't know why

my code :

  
function mp() 
    n1 = math.random(1,3) 
    n2 = math.random(1,3) 
    na = n1*n2 
    outputChatBox("The Math Problem Is "..n1.." X "..n2.." = ?") 
end 
setTimer(mp,5000,0) 
function onChat ( message, messageType ) 
    if message == na then 
        outputChatBox("Good Job") 
    end 
end 
addEventHandler ("onPlayerChat",getRootElement(),onChat) 
  

no errors in /debug script 3

can anyone help me ?

Sorry For My Bad English

Link to comment

have to be serverside

  
function mp() 
    n1 = math.random(1,3) 
    n2 = math.random(1,3) 
    na = n1*n2 
    outputChatBox("The Math Problem Is "..n1.." X "..n2.." = ?") 
end 
setTimer(mp,60000,0) --u don't want every 5sec, do you?i put 1minute 
function onChat ( message, messageType ) 
    if tonumber(message) == na then 
        outputChatBox("Good Job") 
    end 
end 
addEventHandler ("onPlayerChat",getRootElement(),onChat) 
  

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