Jump to content

Block bots with captcha


Recommended Posts

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

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

 

Link to comment
Share on other sites

  • Replies 12
  • Created
  • Last Reply

Top Posters In This Topic

13 minutes ago, Abel(Tiger) said:

Replace "cmdchat("anti_bot_exit_now")" with "pc.disconnect_with_delay(10)" and will disconnect player from server not from client.

PS: I don't recommend quest with unlimited timer.

Because the target is Bots, can you tell me if the player must click on to work? Or it works the same time with the say"20 seconds to answer have passed.")?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.