[FilterScript] Seguridad Captcha
#1

Aqui les dejo un FS para comprobar que un usuario es real, mediante un cуdigo de seguridad
pawn Код:
/*==============================================================================
  [FS] Seguridad Captcha 0.1 (con dialogos)
* Sistema de Ingreso con Codigo de Seguridad via dialogo inputtext                                   *
* Autor: NullBot                                                               *
* Versiуn: 0.1                                                                 *
* Versiуn SA-MP: 0.3z                                                          *
* Tipo de script: FilterScript                                                 *
* Fecha: 12/08/2017                                                            *
* Crйditos:                                                                    *
*   - Forum.sa-mp.com                                                          *                                                   *
*   - http://www.puramasacre.com                                                      *                      *
==============================================================================*/

#define FILTERSCRIPT
#include <a_samp>
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#define DIALOGO_CAPTCHA 31214
#define MAX_CARACTER 5
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
new Captcha[MAX_PLAYERS][MAX_CARACTER];
new bool:Acceso[MAX_PLAYERS] = {false, ...};
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptInit()
{
    printf("\n [FS]Seguridad Captcha | Por NullBot");
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnFilterScriptExit()
{
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnPlayerConnect(playerid)
{
    Acceso[playerid] = false;
    Captcha[playerid]= CrearCodigo();
    new
         caption[64],
         info[MAX_CARACTER];

    format(caption, sizeof caption, "{B44637}ingrese el siguiente cуdigo de seguridad{BEBEBE}: ");
    format(info, sizeof info, "%s",Captcha[playerid]);
   

    ShowPlayerDialog(playerid, DIALOGO_CAPTCHA, DIALOG_STYLE_INPUT, caption, info, "Aceptar", "Cancelar");
    return SetTimerEx("Expulsar", 7000, false, "i", playerid);
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
forward Expulsar(playerid);
public Expulsar(playerid)
{
    if(Acceso[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! | baneada la ip '%s'", IP);
    printf("\n%s",string);
    Kick(playerid);
    return 1;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
stock CrearCodigo()
{
    new
        Codigo[19] = "3CFGHJ4KMNPRTVWXYZ",
        captcha_tmp[MAX_CARACTER]= "Null";
   
    for(new j = 0; j < MAX_CARACTER-1; j++)
    {
        new letra;
        letra = Codigo[random(strlen( Codigo))];
        captcha_tmp[j] = letra;
    }
    return captcha_tmp;

}



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



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

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

    return 1;
}
// creditos jugadores de http://www.puramasacre.com
Reply


Messages In This Thread
Seguridad Captcha - by NullBot - 08.12.2014, 16:18
Respuesta: Seguridad Captcha - by oOFotherOo - 08.12.2014, 16:22
Re: Seguridad Captcha - by LiMPiTo - 08.12.2014, 16:24
Re: Seguridad Captcha - by NullBot - 08.12.2014, 17:37
Respuesta: Seguridad Captcha - by Juand - 08.12.2014, 21:02
Re: Seguridad Captcha - by NullBot - 08.12.2014, 22:04
Respuesta: Re: Seguridad Captcha - by Juand - 08.12.2014, 22:11
Re: Seguridad Captcha - by NullBot - 08.12.2014, 22:18
Respuesta: Re: Seguridad Captcha - by Juand - 08.12.2014, 22:47
Respuesta: Seguridad Captcha - by Revelation - 09.12.2014, 05:37

Forum Jump:


Users browsing this thread: 2 Guest(s)