I want know what fail in my script because i'm new in LUA Scripting and if a "professional" resolve my problem maybe i can learn of that
In this script i want make math problems and if the players resolve this gain $2k
setTimer(function()
x1 = math.random(500)
x2 = math.random(600)
outputChatBox("#1860F1[Math]#ffffff " .. x1 .. " + " .. x2 .. " = ", root, 255, 255, 255, true)
end, 30000, 0)
function mathSystem(text, source)
outputChatBox(text, source, 255, 255, 255, true)
if text == x1 + x2 then
givePlayerMoney(source, 2000)
end
end
addEventHandler("onPlayerChat", root, mathSystem)