viewing paste Simple Bot Check - Color Test v2 | Diff

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 
 
-   script  bot_checking_color  -1,{
    OnInit:
        setarray .code_range,
            10000,
            999999;
            
        setarray .color$,
            "^00FF00", 
            "^FF0000", 
            "^0000FF", 
            "^0FF0FF", 
            "^CCCCCC", 
            "^CBCBCB";
        set .color_size,getarraysize( .color$ );
        end;
        
    OnPCLoginEvent:
        set .@right_color,rand( .color_size );
        set .@random_code$,""+rand( .code_range[0],.code_range[1] );
        
        mes "Enter color "+.color$[.@right_color]+"########^000000";
        for ( set .@i,0; .@i < .color_size; set .@i,.@i + 1 )
            mes .color$[.@i]+ ( ( .@i == .@right_color )? .@random_code$:rand( .code_range[0],.code_range[1] ) ) + "^000000";
        do {
            .@attempt++;
            input .@code$;
        } while( .@code$ != .@random_code$ && .@attempt <= 3 );
    
        if ( .@code$ == .@random_code$ && .@attempt <= 3 ) {
            mes "Correct.";
        }
        else {
            atcommand "@kick "+strcharinfo(0);
        }
        close;
}
Viewed 1287 times, submitted by Emistry.