LMAO !!! this script was made for over 4 years, and only today I found out it has a bug http://herc.ws/board/topic/11445-sameip-command-for-rathena/
.@nb = query_sql( "select name, char_id, account_id as aaa, ( select last_ip from login where account_id = aaa ) from `char` where online = 1", .@name$, .@aid, .@cid, .@ip$ );
look closely, name, char_id, account_id, === BUT .@name$, .@aid, .@cid
up version 0.3
//===== Hercules Script ======================================
//= @sameip
//===== By: ==================================================
//= AnnieRuru
//===== Current Version: =====================================
//= 0.3
//===== Compatible With: =====================================
//= Hercules 2019-02-01
//===== Description: =========================================
//= list all players with same ip address
//===== Topic ================================================
//= https://rathena.org/board/topic/118137-error-buildin_getmapxy/
//===== Additional Comments: =================================
//= it always list all players online, unable to limit to a single map currently
//============================================================
- script kjdshfksfj FAKE_NPC,{
OnInit:
bindatcmd "sameip", strnpcinfo(0)+"::Onaaa";
end;
Onaaa:
freeloop true;
.@nb = query_sql( "select name, char_id, account_id as aaa, ( select last_ip from login where account_id = aaa ) from `char` where online = 1", .@name$, .@cid, .@aid, .@ip$ );
for ( .@i = 0; .@i < .@nb; ++.@i ) {
for ( .@j = 0; .@j < .@ip_list; ++.@j )
if ( .@b_ip$[.@j] == .@ip$[.@i] )
break;
if ( .@j == .@ip_list ) {
.@b_ip$[.@j] = .@ip$[.@i];
++.@ip_list;
}
setd ".@b_ip"+ .@j +"_name$["+ .@b_ip_size[.@j] +"]", .@name$[.@i];
setd ".@b_ip"+ .@j +"_cid["+ .@b_ip_size[.@j] +"]", .@cid[.@i];
setd ".@b_ip"+ .@j +"_aid["+ .@b_ip_size[.@j] +"]", .@aid[.@i];
++.@b_ip_size[.@j];
}
dispbottom "===== SAME IP Searching =====";
for ( .@i = 0; .@i < .@ip_list; ++.@i ) {
if ( .@b_ip_size[.@i] > 1 ) {
dispbottom " == The IP ["+ .@b_ip$[.@i] +"] has "+ .@b_ip_size[.@i] +" players.";
for ( .@j = 0; .@j < .@b_ip_size[.@i]; ++.@j ) {
getmapxy .@map$, .@x, .@y, UNITTYPE_PC, getd( ".@b_ip"+ .@i +"_aid["+ .@j +"]");
dispbottom " = "+( .@j +1 )+". ("+ getd( ".@b_ip"+ .@i +"_cid["+ .@j +"]" ) +") "+ getd( ".@b_ip"+ .@i +"_name$["+ .@j +"]") +" -> "+ .@map$ +" "+ .@x +" "+ .@y;
}
++.@result;
}
}
dispbottom ">>> "+ .@result +" results found.";
end;
}
EDIT: I think should write another version 0.4 since rathena has already upgrade the script engine quite some time ago
the only optimization I can think of is using inarray script command, so nah