- shop anti_bot_shop -1,909:-1 - script anti_bot_shop_main -1,{ OnInit: .max_wrong_count = 3; .duration = 5; .shop_name$ = "anti_bot_shop"; setarray .item_list, 501, 502, 503, 504, 505; .item_list_size = getarraysize( .item_list ); .npc_name$ = strnpcinfo(3); npcshopdelitem .shop_name$,909; for ( .@i = 0; .@i < .item_list_size; .@i++ ) npcshopadditem .shop_name$,.item_list[.@i],-1; end; OnPCLoginEvent: mes "Welcome!"; mes "Protecting the player's benefit, we have an anti-bot checking. Please finish it within "+.duration+" seconds."; mes "When "+.max_wrong_count+" attempts failed will sent you to jail."; next; OnRepeat: @wrong_count++; mes "attempt : "+@wrong_count+"/"+.max_wrong_count; deltimer .npc_name$+"::OnJail"; addtimer ( .duration * 1000 ),.npc_name$+"::OnJail"; @rand_itemid = .item_list[ rand( .item_list_size ) ]; @rand_amount = rand( 1,100 ); mes "Please buy "+@rand_amount+" "+getitemname( @rand_itemid )+"."; npcshopattach .shop_name$,1; callshop .shop_name$,1; end; OnBuyItem: if ( @bought_nameid[0] != @rand_itemid || @bought_quantity[0] != @rand_amount ) { mes "Wrong."; close2; if ( @wrong_count >= .max_wrong_count ) { doevent .npc_name$+"::OnJail"; } else { doevent .npc_name$+"::OnRepeat"; } } deltimer .npc_name$+"::OnJail"; end; OnJail: mes "Failed."; atcommand "@jail "+strcharinfo(0); end; }