REKT 10 Posted December 12, 2015 (edited) @@AnnieRuru can you please help me with this? Edited December 12, 2015 by AnnieRuru split topic from topic/7406-request-sameip/ Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted December 13, 2015 eh ? I thought just change ++.@i into .@i++ will work for rathena already ? because I saw you did it before on other topic - script kjdshfksfj FAKE_NPC,{OnInit: bindatcmd "sameip", strnpcinfo(0)+"::Onaaa"; end;Onaaa: freeloop true; .@nb = query_sql( "select `char`.name, char_id, last_ip from login left join `char` on login.account_id = `char`.account_id where online = 1", .@name$, .@cid, .@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] +""; .@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, 0, getd( ".@b_ip"+ .@i +"_name$["+ .@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;} btw the source version ... I got problem with it ... map-server keep crashing when it initialize 2 dimension array I guess have to learn how to use struct ... Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted December 12, 2015 yea that script ... sql query not optimized reference -> https://www.eathena.ws/board/index.php?s=&showtopic=271842&view=findpost&p=1489957 erm ... its not that complex actually, just like this select `char`.name, login.account_id, last_ip from login left join `char` on login.account_id = `char`.account_id where online = 1 order by last_ip,account_id;.. curious, you want the plugin version or the script version ? and you want to display all online character or just specific map ? Quote Share this post Link to post Share on other sites
0 REKT 10 Posted December 12, 2015 yea that script ... sql query not optimized reference -> https://www.eathena.ws/board/index.php?s=&showtopic=271842&view=findpost&p=1489957 erm ... its not that complex actually, just like this select `char`.name, login.account_id, last_ip from login left join `char` on login.account_id = `char`.account_id where online = 1 order by last_ip,account_id;.. curious, you want the plugin version or the script version ? and you want to display all online character or just specific map ? How i wish, rAthena has a Plugin- System Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted December 12, 2015 (edited) rathena also have srccustomatcommand.inc ... I think I can write this one, if just write in atcommand.inc, the format with hercules shouldn't be that far off Edited December 12, 2015 by AnnieRuru Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted December 12, 2015 (edited) script version ... should be faster than GMOcean's version because I only list online players, but his query will list all login table search all online players and only list if they have 2 same ip or above . - script kjdshfksfj FAKE_NPC,{OnInit: bindatcmd "sameip", strnpcinfo(0)+"::Onaaa"; end;Onaaa: freeloop true; .@nb = query_sql( "select `char`.name, char_id, last_ip from login left join `char` on login.account_id = `char`.account_id where online = 1", .@name$, .@cid, .@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] +""; ++.@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, 0, getd( ".@b_ip"+ .@i +"_name$["+ .@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;}.now tackle the source version in theory, source code should be faster than script Edited December 12, 2015 by AnnieRuru 2 Legend and evilpuncker reacted to this Quote Share this post Link to post Share on other sites
0 REKT 10 Posted December 13, 2015 Thank you for this script @@AnnieRuru i really appreciate it. I guess, this script works only for Hercules. Quote Share this post Link to post Share on other sites
0 REKT 10 Posted December 13, 2015 IT works @@AnnieRuru, thank you for having this time. Anyways, for the source. hopefully you could make also. Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted December 19, 2015 sorry, bump //===== Hercules Script ======================================//= @sameip//===== By: ==================================================//= AnnieRuru//===== Current Version: =====================================//= 0.2//===== Compatible With: ===================================== //= Hercules 2015-12-19//===== Description: =========================================//= list all players with same ip address//===== Topic ================================================//= http://herc.ws/board/topic/11445-sameip-command-for-rathena///===== 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$, .@aid, .@cid, .@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] +""; ++.@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, 0, getd( ".@b_ip"+ .@i +"_name$["+ .@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;}use this one, I totally forgot about about table joining will cause the query run slowerwhen I was cleaning up my old scripts, I relearn this trick Quote Share this post Link to post Share on other sites
@@AnnieRuru can you please help me with this?
Edited by AnnieRurusplit topic from topic/7406-request-sameip/
Share this post
Link to post
Share on other sites