pastebin - collaborative debugging tool
eathena.kpaste.net RSS


ip_lookup.txt
Posted by Anonymous on Wed 2nd Mar 2011 18:03
raw | new post

  1. //===== eAthena Script =======================================
  2. //= IP Lookup NPC
  3. //===== By: ==================================================
  4. //= Brian
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= eAthena SVN
  9. //===== Description: =========================================
  10. //= Look up a char's IP
  11. //===== Additional Comments: =================================
  12. //=
  13. //============================================================
  14.  
  15. quiz_00,0,0,0   script  ip      -1,{
  16. OnWhisperGlobal:
  17.         if (getgmlevel() < 50) end;
  18.         query_sql "SELECT `account_id`,`name` FROM `char` WHERE `name` = '"+escape_sql(@whispervar0$)+"'", .@account_id,.@name$;
  19.         if (.@account_id) {
  20.                 query_sql "SELECT `last_ip` FROM `login` WHERE `account_id`="+.@account_id, .@last_ip$;
  21.                 if (getstrlen(.@last_ip$) >= 7) {
  22.                         dispbottom .@name$+"       "+.@last_ip$;
  23.                        
  24.                         cleararray .@name$[0], "", getarraysize(.@name$);
  25.                         query_sql "SELECT `char`.`name` FROM `char` LEFT JOIN `login` ON `char`.`account_id`=`login`.`account_id` WHERE `login`.`last_ip`='"+.@last_ip$+"' AND `char`.`online`", .@name$;
  26.                         if (getarraysize(.@name$)) {
  27.                                 set .@mes$, .@last_ip$ + "  =  ";
  28.                                 for( set .@i,0; .@i<getarraysize(.@name$); set .@i, .@i +1 )
  29.                                         set .@mes$, .@mes$ + .@name$[.@i] + ", ";
  30.                         } else {
  31.                                 set .@mes$, "No online chars from that IP.";
  32.                         }
  33.                         dispbottom .@mes$;
  34.                 } else
  35.                         dispbottom "Last IP not found.";
  36.         } else {
  37.                 dispbottom "Char name does not exist.";
  38.         }
  39.         end;
  40. }
  41.  
  42. quiz_00,0,0,0   script  char    -1,{
  43. OnWhisperGlobal:
  44.         if (getgmlevel() < 50) end;
  45.         set .@last_ip$, escape_sql(@whispervar0$);
  46.         query_sql "SELECT INET_ATON('"+.@last_ip$+"')", .@ip_dec;
  47.         if (.@ip_dec) {
  48.                 query_sql "SELECT `char`.`name` FROM `char` LEFT JOIN `login` ON `char`.`account_id`=`login`.`account_id` WHERE `login`.`last_ip`='"+.@last_ip$+"' AND `char`.`online`", .@name$;
  49.                 if (getarraysize(.@name$)) {
  50.                         set .@mes$, .@last_ip$ + "  =  ";
  51.                         for( set .@i,0; .@i<getarraysize(.@name$); set .@i, .@i +1 )
  52.                                 set .@mes$, .@mes$ + .@name$[.@i] + ", ";
  53.                 } else {
  54.                         set .@mes$, "No online chars from that IP.";
  55.                 }
  56.         } else {
  57.                 set .@mes$, "Invalid IP address.";
  58.         }
  59.         dispbottom .@mes$;
  60.         end;
  61. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}





All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at