Hey community. I try to make a quest to check if a player is a bot. I want to make the system that if the player doesn't answer after some seconds the game will automatic close.
Here's the quest
Code
- ----------------------------------
- -- ANTI_BOT_CAPTCHA
- -- anti_bot_CAPTCHA
- ----------------------------------
- quest anti_bot_captcha begin
- state start begin
- when login begin
- timer("timer1", 10)
- end
- when timer1.timer begin
- timer("timer2", 10)
- pc.setqf("check_for_answer",get_time()+15)
- local captch = math.random(1001,9999)
- say_title("Anti Bot System ")
- say("Enter the numbers: ")
- say("")
- say_reward(captch)
- local ingre_cap = input()
- ingre_cap=tonumber(ingre_cap)
- if get_time() > pc.getqf("check_for_answer") then ---If the player doesn't answer in 30 seconds the game will close.
- cmdchat("anti_bot_exit_now")
- return
- end
- if ingre_cap == captch then
- return
- else
- cmdchat("anti_bot_exit_now") --- If the player answer wrong captcha the game will close.
- end
- end
- when timer2.timer begin
- timer("timer1", 10)
- pc.setqf("check_for_answer",get_time()+15)
- local captch = math.random(1001,9999)
- say_title("Anti Bot System ")
- say("Enter the numbers: ")
- say("")
- say_reward(captch)
- local ingre_cap = input()
- ingre_cap=tonumber(ingre_cap)
- if get_time() > pc.getqf("check_for_answer") then ---If the player doesn't answer in 30 seconds the game will close.
- cmdchat("anti_bot_exit_now")
- return
- end
- if ingre_cap == captch then
- return
- else
- cmdchat("anti_bot_exit_now") --- If the player answer wrong captcha the game will close.
- end
- end
- end
- end