08.12.2014, 16:38
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