[FilterScript] Security Captcha
#1

useful FS for security bots!
pawn Код:
/*==============================================================================
  [FS] Security Captcha 0.1 (with dialog's)                                    *
* made by: NullBot                                                               *
* Version: 0.1                                                                 *
* Version SA-MP: 0.3z                                                          *
* Tipe of script: FilterScript                                                 *
* date: 12/08/2017                                                            *
* Crйdits:                                                                    *
*   - Forum.sa-mp.com                                                          *                                                   *
*   - http://www.puramasacre.com                                                      *                      *
==============================================================================*/

#define FILTERSCRIPT
#include <a_samp>
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define DIALOG_CAPTCHA 31214
#define MAX_CHARACTER 5
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
new Captcha[MAX_PLAYERS][MAX_CHARACTER];
new bool:Acces[MAX_PLAYERS] = {false, ...};
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptInit()
{
    printf("\n [FS]Security Captcha | by NullBot");
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptExit()
{
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerConnect(playerid)
{
    Acces[playerid] = false;
    Captcha[playerid]= MakeCode();
    new
         caption[64],
         info[MAX_CHARACTER];

    format(caption, sizeof caption, "{B44637}Input the follow security code{BEBEBE}: ");
    format(info, sizeof info, "%s",Captcha[playerid]);
   

    ShowPlayerDialog(playerid, DIALOG_CAPTCHA, DIALOG_STYLE_INPUT, caption, info, "Aceptar", "Cancelar");
    return SetTimerEx("Kick_bot", 7000, false, "i", playerid);
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
forward Kick_bot(playerid);
public Kick_bot(playerid)
{
    if(Acces[playerid]) return 1;
    new
        comando[64],
        string[64],
        IP[32];
       
    GetPlayerIp(playerid,IP,32);
    format(comando, sizeof comando, "banip %s", IP);
    SendRconCommand(comando);
    format(string, sizeof string, "#ERROR Captcha! |Ip banned '%s'", IP);
    printf("\n%s",string);
    Kick(playerid);
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
stock MakeCode()
{
    new
        Codigo[19] = "3CFGHJ4KMNPRTVWXYZ",
        captcha_tmp[MAX_CHARACTER]= "Null";
   
    for(new j = 0; j < MAX_CHARACTER-1; j++)
    {
        new l;
        l = Codigo[random(strlen( Codigo))];
        captcha_tmp[j] = l;
    }
    return captcha_tmp;

}



//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}



//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CAPTCHA)
    {
        if(response)
        {  

            if(!strcmp(Captcha[playerid], inputtext, true))
                Acces[playerid] = true;
            else Acces[playerid] = false;
        }else Acces[playerid] = false;
        if(!Acces[playerid])Kick_bot(playerid);
        return 1;
    }

    return 1;
}
// credits players de http://www.puramasacre.com
Reply
#2

Picture please? looks interesting. The topic looks poor only with coding. (Put more effort on it, show people what excatly is this.)
Reply
#3

when a player connect the script have 7-8 seconds for put the correct security code if the code is incorrect the player ip is banned or if not put the code before 7 secods is banned too
Reply
#4

Dear Nullbot,

Feeling sad to tell you that this system really looking Nonsense. If anyone type and incorrect captcha by mistake. He got banned?
Then no one likes to play such a server. Anyway your idea is great. Use Kick instesd of ban and Give 2- 3 tries if anyone put an incorrect response. Also you need to extend the time up to 30 sec may looks cool.

Thanks for providing such Ideal Filterscripts
Regards
Reply
#5

Security bots, i dont get it pictures please
Reply
#6

Please can you change the ban to kick so I can use the script on my server of course with your credits.
Reply
#7

i change the ban for kick
pawn Код:
/*==============================================================================
  [FS] Security Captcha 0.1 (with dialog's)                                    *
* made by: NullBot                                                               *
* Version: 0.1                                                                 *
* Version SA-MP: 0.3z                                                          *
* Tipe of script: FilterScript                                                 *
* date: 12/08/2017                                                            *
* Crйdits:                                                                    *
*   - Forum.sa-mp.com                                                          *                                                   *
*   - http://www.puramasacre.com                                                      *                      *
==============================================================================*/

#define FILTERSCRIPT
#include <a_samp>
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define DIALOG_CAPTCHA 31214
#define MAX_CHARACTER 5
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
new Captcha[MAX_PLAYERS][MAX_CHARACTER];
new bool:Acces[MAX_PLAYERS] = {false, ...};
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptInit()
{
    printf("\n [FS]Security Captcha | by NullBot");
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptExit()
{
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerConnect(playerid)
{
    Acces[playerid] = false;
    Captcha[playerid]= MakeCode();
    new
         caption[64],
         info[MAX_CHARACTER];

    format(caption, sizeof caption, "{B44637}Input the follow security code{BEBEBE}: ");
    format(info, sizeof info, "%s",Captcha[playerid]);
   

    ShowPlayerDialog(playerid, DIALOG_CAPTCHA, DIALOG_STYLE_INPUT, caption, info, "Aceptar", "Cancelar");
    return SetTimerEx("Kick_bot", 7000, false, "i", playerid);
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
forward Kick_bot(playerid);
public Kick_bot(playerid)
{
    if(Acces[playerid]) return 1;
    new
        string[64],
        IP[32];
       
    GetPlayerIp(playerid,IP,32);
    format(string, sizeof string, "#ERROR Captcha! |Ip: '%s'", IP);
    printf("\n%s",string);
    Kick(playerid);
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
stock MakeCode()
{
    new
        Codigo[19] = "3CFGHJ4KMNPRTVWXYZ",
        captcha_tmp[MAX_CHARACTER]= "Null";
   
    for(new j = 0; j < MAX_CHARACTER-1; j++)
    {
        new l;
        l = Codigo[random(strlen( Codigo))];
        captcha_tmp[j] = l;
    }
    return captcha_tmp;

}



//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}



//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CAPTCHA)
    {
        if(response)
        {  

            if(!strcmp(Captcha[playerid], inputtext, true))
                Acces[playerid] = true;
            else Acces[playerid] = false;
        }else Acces[playerid] = false;
        if(!Acces[playerid])Kick_bot(playerid);
        return 1;
    }

    return 1;
}
// credits players de http://www.puramasacre.com
+rep
Reply
#8

Good concept, wrong way to go about it. It's unfair that a player didn't type his password in within 7 seconds of login, so he gets banned. Honestly, I know we can change it, but that is unacceptable to have it come standard with settings like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)