Jump to content
  • 0
karazu

IP checker. kick 5 accounts with same IP in same MAP

Question

I saw a post like this before but I cannot find it anymore.

If you can find i can u link me?

or can u just make a script for me please?



EDIT:
 

 

 

-	script	Sample	-1,{OnPCLoadMapEvent:if( strcharinfo(3) == .Map$ ){query_sql( "SELECT `last_ip` FROM `login` WHERE account_id="+getcharid(3)+"",.@IP );query_sql( "SELECT `account_id` FROM `login` WHERE last_ip="+.@IP+"",.@Accountlist );for( set .@i,0; .@i < getarraysize( .@Accountlist ); set .@i,.@i + 1 )	if( isloggedin( .@Accountlist[.@i] ) )		set .@DetectedOnline,.@DetectedOnline + 1;	if( .@DetectedOnline > .Limit ){		mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";		mes "Please log off these unused account.";		close2;		warp "prontera",155,181;	}}end;OnInit:// How many User with Same IP can logged in and stay at the specific mapset .Limit,2;// What map will be restrictedset .Map$,"payon";setmapflag .Map$,mf_loadevent;end;} 

http://rathena.org/board/topic/58835-request-ip-check/

found this script in RA can anyone make this work please?

Edited by karazu

Share this post


Link to post
Share on other sites

19 answers to this question

Recommended Posts

  • 0

Script seems to work in a 2013-11-15 revision without problems.

 

The head line of the script needs the groups of parameters to be separated by tabulation spaces instead of regular spaces:

-	script	Sample	-1,{OnPCLoadMapEvent:if( strcharinfo(3) == .Map$ ){query_sql( "SELECT `last_ip` FROM `login` WHERE account_id="+getcharid(3)+"",.@IP );query_sql( "SELECT `account_id` FROM `login` WHERE last_ip="+.@IP+"",.@Accountlist );for( set .@i,0; .@i < getarraysize( .@Accountlist ); set .@i,.@i + 1 )    if( isloggedin( .@Accountlist[.@i] ) )        set .@DetectedOnline,.@DetectedOnline + 1;    if( .@DetectedOnline > .Limit ){        mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";        mes "Please log off these unused account.";        close2;        warp "prontera",155,181;    }}end;OnInit:// How many User with Same IP can logged in and stay at the specific mapset .Limit,2;// What map will be restrictedset .Map$,"payon";setmapflag .Map$,mf_loadevent;end;}

 

It also seems fine. Not optimised but that still should work in Hercules.

Share this post


Link to post
Share on other sites
  • 0

Script seems to work in a 2013-11-15 revision without problems.

 

The head line of the script needs the groups of parameters to be separated by tabulation spaces instead of regular spaces:

-	script	Sample	-1,{OnPCLoadMapEvent:if( strcharinfo(3) == .Map$ ){query_sql( "SELECT `last_ip` FROM `login` WHERE account_id="+getcharid(3)+"",.@IP );query_sql( "SELECT `account_id` FROM `login` WHERE last_ip="+.@IP+"",.@Accountlist );for( set .@i,0; .@i < getarraysize( .@Accountlist ); set .@i,.@i + 1 )    if( isloggedin( .@Accountlist[.@i] ) )        set .@DetectedOnline,.@DetectedOnline + 1;    if( .@DetectedOnline > .Limit ){        mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";        mes "Please log off these unused account.";        close2;        warp "prontera",155,181;    }}end;OnInit:// How many User with Same IP can logged in and stay at the specific mapset .Limit,2;// What map will be restrictedset .Map$,"payon";setmapflag .Map$,mf_loadevent;end;}

 

It also seems fine. Not optimised but that still should work in Hercules.

 

I think  script should check where the player in array is , so....

 

if( !getmapxy(.@m$,.@x,.@y,0,rid2name(.@Accountlist[.@i]) && .@m$ == .Map$ )        set .@DetectedOnline,.@DetectedOnline + 1;

Share this post


Link to post
Share on other sites
  • 0

The script trigger a loadevent mapflag on payon map only. So the onpcloadmapevent event will only work on payon. There is no need for the getmapxy command as of what the script has as of the moment.

Share this post


Link to post
Share on other sites
  • 0

setarray :

*setarray <array name>[<first value>],<value>{,<value>...<value>};This command will allow you to quickly fill up an array in one go. Checkthe Kafra scripts in the distribution to see this used a lot.	setarray @array[0], 100, 200, 300, 400, 500, 600;First value is the index of the first element of the array to alter. Forexample:	setarray @array[0],200,200,200;	setarray @array[1],300,150;will produce:@array[0]=200@array[1]=300@array[2]=150

 

and getarraysize :

 

*getarraysize(<array name>)This function returns the number of values that are contained inside thespecified array. Notice that zeros and empty strings at the end of thisarray are not counted towards this number.For example:	setarray @array[0], 100, 200, 300, 400, 500, 600;	set @arraysize,getarraysize(@array);This will make @arraysize == 6. But if you try this:	setarray @array[0], 100, 200, 300, 400, 500, 600, 0;	set @arraysize,getarraysize(@array);@arraysize will still equal 6, even though you've set 7 values.

 

- set .Map$,"payon";- setmapflag .Map$,mf_loadevent;+ setarray .Map$,"payon","prontera";+	 for ( .@x = 0; .@x < getarraysize(.Map$); .@x++ )+		 setmapflag .Map$[.@x],mf_loadevent;

This time since it triggers multiple maps via loadevent. You need to check if both players with same ip are in the same map.

Edited by Patskie

Share this post


Link to post
Share on other sites
  • 0
-	script	Sample	-1,{OnPCLoadMapEvent:if( strcharinfo(3) == .Map$ ){query_sql( "SELECT `last_ip` FROM `login` WHERE account_id="+getcharid(3)+"",.@IP );query_sql( "SELECT `account_id` FROM `login` WHERE last_ip="+.@IP+"",.@Accountlist );for( set .@i,0; .@i < getarraysize( .@Accountlist ); set .@i,.@i + 1 )    if( isloggedin( .@Accountlist[.@i] ) )        set .@DetectedOnline,.@DetectedOnline + 1;    if( .@DetectedOnline > .Limit ){        mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";        mes "Please log off these unused account.";        close2;        warp "prontera",155,181;    }}end;OnInit:// How many User with Same IP can logged in and stay at the specific mapset .Limit,2;// What map will be restrictedsetarray .Map$,"payon","prontera";	 for ( .@x = 0; .@x < getarraysize(.Map$); .@x++ )		 setmapflag .Map$[.@x],mf_loadevent;end;} 

Is this correct?

Share this post


Link to post
Share on other sites
  • 0
-	script	dualclientkicker	-1,{OnPCLoadMapEvent:	set .@charmap$, strcharinfo(3);	if(!compare(.tmp$,.@charmap$)) end;	set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND `online` <> 0;",.@a);	if(.@len-1) {		for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {			getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d]));			if(.@charmap$==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) {				dispbottom "Duel accounts not allowed in WOE.";				warp "geffen",0,0;			}		}	}	end;	OnInit:	setarray .maps$ ,	"aldeg_cas01", "gefg_cas01", "payg_cas01", "prtg_cas01";	set .lens ,	getarraysize(.maps$) ;	for(set(.a,0);.a<.lens;set(.a,.a+1)) {		setmapflag .maps$[.a],	mf_loadevent ;		set .tmp$ ,.tmp$+.maps$[.a]+",";	}} 

I think this script limits only up to 2, how about I will make atleast 5 characters per map with same IP?

Share this post


Link to post
Share on other sites
  • 0

Try : 

+ if ( .@ctr >= 5 ) {+	 dispbottom "No same IP please.";+	 sleep2 2000;+	 warp "geffen",0,0;+ }+ .@ctr++;- dispbottom "Duel accounts not allowed in WOE.";- warp "geffen",0,0;

Share this post


Link to post
Share on other sites
  • 0

 

-    script    dualclientkicker    -1,{OnPCLoadMapEvent:    set .@charmap$, strcharinfo(3);    if(!compare(.tmp$,.@charmap$)) end;   set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE`account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` =(SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND`online` <> 0;",.@a);    for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {        if(!getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d])) && .@charmap$==.@map$)            set .@c,.@c+ 1;     }    if(.@c > .limitacc ) {            dispbottom "Duel accounts not allowed in WOE.";             warp "geffen",0,0;    }    end;    OnInit:     set .limitacc,5;    setarray .maps$,"aldeg_cas01", "gefg_cas01", "payg_cas01", "prtg_cas01";        set .lens ,    getarraysize(.maps$) ;        for(set(.a,0);.a<.lens;set(.a,.a+1)) {	        setmapflag .maps$[.a],    mf_loadevent ;	        set .tmp$ ,.tmp$+.maps$[.a]+",";        }}

Share this post


Link to post
Share on other sites
  • 0

Yes you can. Just remember that you've to specify player name if I remember correctly:

 

atcommand "@kick"+strcharinfo(0);

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.