Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ACMD_FUNC(kickip) {
- struct map_session_data* pl_sd;
- struct s_mapiterator* iter;
- int account_id = 0;
- int kick_count = 0;
- char *data;
- nullpo_retr(-1, sd);
- if( !message || !*message ){
- clif_displaymessage( fd, "Usage: @kickip <ip address> ( @kickip 192.168.1.1 )" );
- return -1;
- }
- if( SQL_ERROR == Sql_Query( mmysql_handle, "SELECT `account_id` FROM `login` WHERE `last_ip` LIKE '%s'", message ) ){
- clif_displaymessage(fd, "Query Error on @kickip.");
- Sql_FreeResult( mmysql_handle );
- return -1;
- }else if( Sql_NumRows( mmysql_handle ) == 0 ){
- clif_displaymessage(fd, "IP Address not found.");
- Sql_FreeResult( mmysql_handle );
- return -1;
- }else{
- while( SQL_SUCCESS == Sql_NextRow( mmysql_handle ) ){
- Sql_GetData(mmysql_handle, 0, &data, NULL);
- account_id = atoi(data);
- iter = mapit_getallusers();
- for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ){
- if( sd->status.account_id == account_id && sd->status.account_id != pl_sd->status.account_id ){
- clif_GM_kick(NULL, pl_sd);
- kick_count++;
- }
- }
- mapit_free(iter);
- }
- Sql_FreeResult( mmysql_handle );
- sprintf( atcmd_output, "Kicked %d users with IP filtered by '%s'.", kick_count, message );
- clif_displaymessage(fd, atcmd_output);
- return -1;
- }
- return 0;
- }
- // very below part add this....
- { "kickip", 99,99, atcommand_kickip }, // by Emistry
Advertisement
Add Comment
Please, Sign In to add comment