yuhsing

Untitled

Sep 28th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1.  
  2. ACMD_FUNC(kickip) {
  3. struct map_session_data* pl_sd;
  4. struct s_mapiterator* iter;
  5. int account_id = 0;
  6. int kick_count = 0;
  7. char *data;
  8.  
  9. nullpo_retr(-1, sd);
  10.  
  11. if( !message || !*message ){
  12. clif_displaymessage( fd, "Usage: @kickip <ip address> ( @kickip 192.168.1.1 )" );
  13. return -1;
  14. }
  15.  
  16. if( SQL_ERROR == Sql_Query( mmysql_handle, "SELECT `account_id` FROM `login` WHERE `last_ip` LIKE '%s'", message ) ){
  17. clif_displaymessage(fd, "Query Error on @kickip.");
  18. Sql_FreeResult( mmysql_handle );
  19. return -1;
  20.  
  21. }else if( Sql_NumRows( mmysql_handle ) == 0 ){
  22. clif_displaymessage(fd, "IP Address not found.");
  23. Sql_FreeResult( mmysql_handle );
  24. return -1;
  25.  
  26. }else{
  27.  
  28. while( SQL_SUCCESS == Sql_NextRow( mmysql_handle ) ){
  29. Sql_GetData(mmysql_handle, 0, &data, NULL);
  30. account_id = atoi(data);
  31.  
  32. iter = mapit_getallusers();
  33. for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) ){
  34. if( sd->status.account_id == account_id && sd->status.account_id != pl_sd->status.account_id ){
  35. clif_GM_kick(NULL, pl_sd);
  36. kick_count++;
  37. }
  38. }
  39. mapit_free(iter);
  40. }
  41. Sql_FreeResult( mmysql_handle );
  42.  
  43. sprintf( atcmd_output, "Kicked %d users with IP filtered by '%s'.", kick_count, message );
  44. clif_displaymessage(fd, atcmd_output);
  45.  
  46. return -1;
  47. }
  48. return 0;
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. // very below part add this....
  58.  
  59. { "kickip", 99,99, atcommand_kickip }, // by Emistry
Advertisement
Add Comment
Please, Sign In to add comment