Jump to content

Welcome to M2Tec

The global development community for Metin2

Knowledge is Freedom

Feel free to share your ideas, your knowledge in our community, your community.

Follow the Rules

Respect the rules of the community, the users and their administrative team. Let's be friends!
M2Tec - Community Maintenance Read more... ×
ymirwork

guide metin2 Anti-Bot captcha

Recommended Posts

Posted (edited)

edit: 

Hidden Content

    Give reaction or reply to this topic to see the hidden content.

 

Hi there,

 

i was looking for some nice anti-bot capcha... i didn't find any, so i make one.

Maybe it's not the best, but do his job. "Kick bots from the game."

 

 

game source:

 

cmd_general:

find:

 

TimedEventInfo* info = AllocEventInfo<TimedEventInfo>();
                {
                    if (ch->IsPosition(POS_FIGHTING))
                        info->left_second = 10;
                    else
                        info->left_second = 3;
                }


 

 

 

edit like:

 

TimedEventInfo* info = AllocEventInfo<TimedEventInfo>();
                {
                    if (ch->IsPosition(POS_FIGHTING))
                        info->left_second = 10;
                    else
                        info->left_second = 3;
                    
                    if (ch->GetQuestFlag("captcha_system.captcha_exit") == 1)
                        info->left_second = 25;
                }


 

 

 

battle.cpp

find:

 

 


bool timed_event_cancel(LPCHARACTER ch)

 

 

edit like:

 

bool timed_event_cancel(LPCHARACTER ch)
{
    
    if (ch->m_pkTimedEvent)
    {
        
        if (ch->GetQuestFlag("captcha_system.captcha_exit") == 1)
            return false;
        else
            event_cancel(&ch->m_pkTimedEvent);
            return true;
    }


    return false;
}

 

 

 

quest:

 

 

quest captcha_system begin
    state start begin
        when login begin
            pc.setqf("captcha_exit",0)
            pc.setqf("captcha_count",0)
        end
            
        when kill with not npc.is_pc() begin
            pc.setqf("captcha_count", pc.getqf("captcha_count")+1 )
        
            if pc.getqf("captcha_count") >= 25 then
                pc.setqf("captcha_exit",1)
                command("logout")
                local number = math.random(1111,9999)
                repeat
                    say_title("captcha_system ")
                    say("Enter the numbers: ")
                    say("")
                    say_reward(number)
                    local player_input = tonumber(input())
                    if player_input == nil or player_input != number then
                        say("")
                        say("That captcha is not valid!")
                        say("")
                        local s = select("continue", "cancel")
                        if s == 2 then
                            return
                        end
                    else
                        break
                    end
                until false
                    
                command("logout")
                pc.setqf("captcha_exit",0)
                pc.setqf("captcha_count",0)
            end
        end
        
    end
end

 

Edited by ymirwork
  • Like 27
  • Thanks 1

Share this post


Link to post
Share on other sites

My knowledge of metin2, c++, quest, lua etc is very very very low. If u can make it better, show us! xD

Share this post


Link to post
Share on other sites

Not bad thanks 

  • Haha 1

Share this post


Link to post
Share on other sites
Posted (edited)

small update: xD

 

 

#clientside

Hidden Content

    Give reaction or reply to this topic to see the hidden content.

 

Better quest!

 

 

quest captcha_system begin
    state start begin
        when login begin
            pc.setqf("captcha_exit",0)
            pc.setqf("captcha_count",0)
        end
            
        when kill with not npc.is_pc() begin
            pc.setqf("captcha_count", pc.getqf("captcha_count")+1 )
            if pc.getqf("captcha_count") >= 25 then
                pc.setqf("captcha_exit",1)
                command("logout")
                repeat
                    local number = math.random(1111,9999)
                    say_title("[ENTER]ANTI-BOT[ENTER]")
                    ----"12345678901234567890123456789012345678901234567890"|
                    say("Enter the numbers: ")
                    say("")
                    say_reward(number)
                    local player_input = tonumber(input())
                    if player_input == nil or player_input != number then
                    else
                        break
                    end
                until false
                    
                command("logout")
                pc.setqf("captcha_exit",0)
                pc.setqf("captcha_count",0)
            end
        end
        
    end
end

 

Edited by ymirwork
  • Like 8
  • Thanks 2
  • Haha 1

Share this post


Link to post
Share on other sites

hi you can adjust quest / code for make it according to time maybe flag? like every 25min etc.

if type captcha .. reset timer ..

 

timer is better... kills not good i think ..

 

thanks

Share this post


Link to post
Share on other sites
Posted (edited)
20 minutes ago, Chris Pfeifer said:

hi you can adjust quest / code for make it according to time maybe flag? like every 25min etc.

if type captcha .. reset timer ..

 

timer is better... kills not good i think ..

 

thanks

 

 

i belive kills is better, cuz this way capcha only work in PVM.  With time, u will have to answer capcha in OX, PVP, IN shop....   

 

 

 

edit: I dind't test it, but i think it's this! xD

 

 

 


quest captcha_system begin
    state start begin
        when login begin
            pc.setqf("captcha_exit",0)
            timer("captcha_time", 60*25) --- Change you time in here (60 seconds x YOUR MINUTES)
        end
        
        when captcha_time.timer begin
            pc.setqf("captcha_exit",1)
            command("logout")
            repeat
                local number = math.random(1111,9999)
                say_title("[ENTER]ANTI-BOT[ENTER]")
                ----"12345678901234567890123456789012345678901234567890"|
                say("Enter the numbers: ")
                say("")
                say_reward(number)
                local player_input = tonumber(input())
                if player_input == nil or player_input != number then
                else
                    break
                end
            until false
                
            command("logout")
            pc.setqf("captcha_exit",0)
            timer("captcha_time", 60*25) --- Change you time in here (60 seconds x YOUR MINUTES)
        end
        
    end
end

Edited by ymirwork
  • Thanks 1

Share this post


Link to post
Share on other sites

Nice system, kinda the same from svside. Thanks for sharing your work ❤️

Share this post


Link to post
Share on other sites

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

×