- script antibot -1,{
function GetString;
OnInit:
// mode
// 1 - numbers
// 2 - uppercase letter
// 4 - lowercase letter
// 8 - symbols
set .mode,1|2|4|8;
// 8 ~ 20 characters
setarray .string_size,8,20;
// max wrong attempt
set .max_attempt,5;
end;
OnPCLoginEvent:
attachnpctimer;
initnpctimer;
set .@string$,GetString( .mode,rand( .string_size[0],.string_size[1] ) );
mes "Antibot";
mes "Enter the code below:";
mes "^FF0000"+.@string$+"^000000";
do{
set .@attempt,.@attempt + 1;
dispbottom "Attempt : "+.@attempt;
input( .@code$ );
set .@result,( .@code$ == .@string$ );
if( !.@result && .@attempt >= .max_attempt ){
OnTimer60000:
atcommand "@kick "+strcharinfo(0);
end;
}
}while( .@result );
stopnpctimer;
detachnpctimer;
mes "Done";
close;
function GetString {
set .@arg,getarg(0);
set .@length,getarg(1);
if( .@arg & 1 ) setarray .@list$[ getarraysize( .@list$ ) ],"1","2","3","4","5","6","7","8","9";
if( .@arg & 2 ) setarray .@list$[ getarraysize( .@list$ ) ],"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z";
if( .@arg & 4 ) setarray .@list$[ getarraysize( .@list$ ) ],"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z";
if( .@arg & 8 ) setarray .@list$[ getarraysize( .@list$ ) ],"!","@","#","$","%","^","&","*","(",")","-","=","/","+";
set .@size,getarraysize( .@list$ );
while( getstrlen( .@str$ ) < .@length )
set .@str$,.@str$ + .@list$[ rand( .@size ) ];
return .@str$;
}
}