Jump to content
  • 0

R > IP limit with extra conditions


Meteor91

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

Hello Team,

i would like to get support for this script below. i found this ip limit script in this forum, the script working fine and i use it until now. the problem is, i want to make an adjustment where at prontera city there were no ip limit but when the player warp to dungeon map or other place the script will check whether they have 3 other chars outside prontera. if they have then the 4th login will be kick. i have try to make <if (strcharinfo(3) == "prontera") end;> it is not working means player can use this as advantage to login more than 3 id. kindly guide and assist me on this. below is the code:-

 

-	script	Only3perIP	-1,{
OnPCLoginEvent:
if (getgmlevel() >= 99) end;
set .@myname$, strcharinfo(0);
if (query_sql("SELECT `char`.`name` FROM `char` LEFT JOIN login ON `char`.account_id=login.account_id WHERE login.last_ip='"+getcharip()+"' AND `char`.online=1 AND `char`.char_id!="+getcharid(0), .@name$) >= 3) {
	for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
		if (checkvending(.@name$[.@i]) != 2)
			set .@sameip, .@sameip +1;
	}
	if (.@sameip >= 3) {
		announce "Sorry, only 3 accounts per IP can be logged in at a time.", bc_self;
		sleep 1000;
		atcommand "@kick " + .@myname$;
	}
}
end;
}

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1188
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

2 hours ago, Meteor91 said:

Hello Team,

i would like to get support for this script below. i found this ip limit script in this forum, the script working fine and i use it until now. the problem is, i want to make an adjustment where at prontera city there were no ip limit but when the player warp to dungeon map or other place the script will check whether they have 3 other chars outside prontera. if they have then the 4th login will be kick. i have try to make <if (strcharinfo(3) == "prontera") end;> it is not working means player can use this as advantage to login more than 3 id. kindly guide and assist me on this. below is the code:-

 

-	script	Only3perIP	-1,{
OnPCLoginEvent:
if (getgmlevel() >= 99) end;
set .@myname$, strcharinfo(0);
if (query_sql("SELECT `char`.`name` FROM `char` LEFT JOIN login ON `char`.account_id=login.account_id WHERE login.last_ip='"+getcharip()+"' AND `char`.online=1 AND `char`.char_id!="+getcharid(0), .@name$) >= 3) {
	for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
		if (checkvending(.@name$[.@i]) != 2)
			set .@sameip, .@sameip +1;
	}
	if (.@sameip >= 3) {
		announce "Sorry, only 3 accounts per IP can be logged in at a time.", bc_self;
		sleep 1000;
		atcommand "@kick " + .@myname$;
	}
}
end;
}

 

try my script below

you can edit the map and the condition

-	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 "Dual accounts not allowed in PVP.";
	warp "prontera",0,0;
	}    
	end;
OnInit:
set .limitacc,1;
setarray .maps$,"guild_vs1","guild_vs2","guild_vs3","guild_vs4","guild_vs5","turbo_e_4","turbo_e_8","turbo_e_16",
"pvp_y_1-1","pvp_y_1-2","pvp_y_1-3","pvp_y_1-4","pvp_y_1-5","pvp_y_2-1","pvp_y_2-2","pvp_y_2-3","pvp_y_2-4","pvp_y_2-5",
"pvp_y_3-1","pvp_y_3-2","pvp_y_3-3","pvp_y_3-4","pvp_y_3-5","pvp_y_4-1","pvp_y_4-2","pvp_y_4-3","pvp_y_4-4","pvp_y_4-5",
"pvp_y_5-1","pvp_y_5-2","pvp_y_5-3","pvp_y_5-4","pvp_y_5-5","pvp_y_6-1","pvp_y_6-2","pvp_y_6-3","pvp_y_6-4","pvp_y_6-5",
"pvp_y_7-1","pvp_y_7-2","pvp_y_7-3","pvp_y_7-4","pvp_y_7-5","pvp_y_8-1","pvp_y_8-2","pvp_y_8-3","pvp_y_8-4","pvp_y_8-5",
"pvp_n_1-1","pvp_n_1-2","pvp_n_1-3","pvp_n_1-4","pvp_n_1-5","pvp_n_2-1","pvp_n_2-2","pvp_n_2-3","pvp_n_2-4","pvp_n_2-5",
"pvp_n_3-1","pvp_n_3-2","pvp_n_3-3","pvp_n_3-4","pvp_n_3-5","pvp_n_4-1","pvp_n_4-2","pvp_n_4-3","pvp_n_4-4","pvp_n_4-5",
"pvp_n_5-1","pvp_n_5-2","pvp_n_5-3","pvp_n_5-4","pvp_n_5-5","pvp_n_6-1","pvp_n_6-2","pvp_n_6-3","pvp_n_6-4","pvp_n_6-5",
"pvp_n_7-1","pvp_n_7-2","pvp_n_7-3","pvp_n_7-4","pvp_n_7-5","pvp_n_8-1","pvp_n_8-2","pvp_n_8-3","pvp_n_8-4","pvp_n_8-5",
"pvp_2vs2";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
	setmapflag .maps$[.a],    mf_loadevent ;
	set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

Thanks for the fast response @hendra814, i look into it. anything i will ping here. 😄

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

4 hours ago, hendra814 said:

try my script below

you can edit the map and the condition

-	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 "Dual accounts not allowed in PVP.";
	warp "prontera",0,0;
	}    
	end;
OnInit:
set .limitacc,1;
setarray .maps$,"guild_vs1","guild_vs2","guild_vs3","guild_vs4","guild_vs5","turbo_e_4","turbo_e_8","turbo_e_16",
"pvp_y_1-1","pvp_y_1-2","pvp_y_1-3","pvp_y_1-4","pvp_y_1-5","pvp_y_2-1","pvp_y_2-2","pvp_y_2-3","pvp_y_2-4","pvp_y_2-5",
"pvp_y_3-1","pvp_y_3-2","pvp_y_3-3","pvp_y_3-4","pvp_y_3-5","pvp_y_4-1","pvp_y_4-2","pvp_y_4-3","pvp_y_4-4","pvp_y_4-5",
"pvp_y_5-1","pvp_y_5-2","pvp_y_5-3","pvp_y_5-4","pvp_y_5-5","pvp_y_6-1","pvp_y_6-2","pvp_y_6-3","pvp_y_6-4","pvp_y_6-5",
"pvp_y_7-1","pvp_y_7-2","pvp_y_7-3","pvp_y_7-4","pvp_y_7-5","pvp_y_8-1","pvp_y_8-2","pvp_y_8-3","pvp_y_8-4","pvp_y_8-5",
"pvp_n_1-1","pvp_n_1-2","pvp_n_1-3","pvp_n_1-4","pvp_n_1-5","pvp_n_2-1","pvp_n_2-2","pvp_n_2-3","pvp_n_2-4","pvp_n_2-5",
"pvp_n_3-1","pvp_n_3-2","pvp_n_3-3","pvp_n_3-4","pvp_n_3-5","pvp_n_4-1","pvp_n_4-2","pvp_n_4-3","pvp_n_4-4","pvp_n_4-5",
"pvp_n_5-1","pvp_n_5-2","pvp_n_5-3","pvp_n_5-4","pvp_n_5-5","pvp_n_6-1","pvp_n_6-2","pvp_n_6-3","pvp_n_6-4","pvp_n_6-5",
"pvp_n_7-1","pvp_n_7-2","pvp_n_7-3","pvp_n_7-4","pvp_n_7-5","pvp_n_8-1","pvp_n_8-2","pvp_n_8-3","pvp_n_8-4","pvp_n_8-5",
"pvp_2vs2";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
	setmapflag .maps$[.a],    mf_loadevent ;
	set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

hi hendra814, thanks for the script. i have look into it, for me i wanna to make only prontera can have multiple login do this means i need to put all map inside the array? how about the server processing? is it taking alot of resource or not?

Edited by Meteor91
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  1188
  • Reputation:   161
  • Joined:  06/12/12
  • Last Seen:  

11 hours ago, Meteor91 said:

hi hendra814, thanks for the script. i have look into it, for me i wanna to make only prontera can have multiple login do this means i need to put all map inside the array? how about the server processing? is it taking alot of resource or not?

i'm not sure, but try this

-	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 "Dual client only avaiable at Prontera City";
	warp "SavePoint",0,0;
	}    
	end;
OnInit:
set .limitacc,1;
setarray .maps$,"prontera";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
	setmapflag .maps$[.a],    mf_loadevent ;
	set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  11/30/12
  • Last Seen:  

46 minutes ago, hendra814 said:

i'm not sure, but try this

-	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 "Dual client only avaiable at Prontera City";
	warp "SavePoint",0,0;
	}    
	end;
OnInit:
set .limitacc,1;
setarray .maps$,"prontera";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
	setmapflag .maps$[.a],    mf_loadevent ;
	set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

thanks for reply. the script only works in prontera because of mapflag. my intention to make the check outside of prontera which mean prontera can have dual login other map cannot. by using OnPCLoadMapEvent: it already nice but the problem is it need mapflag to trigger to avoid something like said in the documentation "The fact that this label requires a mapflag for it to work is because, otherwise, it'd be server-wide and trigger every time a player would change maps. Imagine the server load with 1,000 players (oh the pain...)". i like your idea from previous script, but im just need to supply all the map exist in RO for the array. oh what a pain.. hahaha

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...