@sameip command for rathena

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 ?

 
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
default_biggrin.png


 
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

 
Last edited by a moderator:
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

 
Last edited by a moderator:
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;}
screenRuru_Server009.jpg
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 ...

 
IT works @@AnnieRuru, thank you for having this time.

Anyways, for the source. hopefully you could make also. 
default_tongue.png


 
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

 
Back
Top