Jump to content
  • 0

limit chars per IP or MAC, but no limit on @autotrade merchants


eliandrotc

Question


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

hi guys.

i have a problem.. i'm using this script...works fine, if 2 acc login, the last is kicked.

I need to identify the two accounts, but do not count the @AT merchants.

if i have 10 @at merchants, and 2 online accounts..only 2 online will be checked. and 1 kicked.

- script Only2perIP -1,{

OnPCLoginEvent:

if(getgmlevel()<=99){

end;

} else {

set .@name$, strcharinfo(0);

if (query_sql("SELECT login.account_id FROM login LEFT JOIN `char` ON login.account_id=`char`.account_id WHERE login.last_ip=(SELECT last_ip FROM login WHERE

account_id="+getcharid(3)+") AND `char`.online=1", .@account_id) > 1) {

announce "Sorry, only 2 accounts per IP are allowed!", bc_self;

sleep 1000;

atcommand "@kick " + .@name$;

}

end;

}

}

sorry for my bad english..

tks.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

ok ...testing..

sorry for my bad explain...

one error now.

script error on npc/custom/oneperip.txt line 871

parse_callfunc: expected ')' to close argument list

866 : announce "esse eh o npc certo",8;

867 : sleep2 5000;

868 : getmapxy(.@amap$,.@mapx,.@mapy,0);

869 : if(.@amap$=="izlude") end;

870 : dispbottom "Sistema anti dual Mac ativado com sucesso!!";

* 871 : 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$) >= 1) {

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Here you go:

-	script	Only2perIP	-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$) >= 2) {
	for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
		if (checkvending(.@name$[.@i]) != 2)
			set .@sameip, .@sameip +1;
	}
	if (.@sameip >= 2) {
		announce "Sorry, only 2 accounts per IP can be logged in at a time.", bc_self;
		sleep 1000;
		atcommand "@kick " + .@myname$;
	}
}
end;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  95
  • Reputation:   29
  • Joined:  10/11/12
  • Last Seen:  

With this code, players at lan houses can't play together... Or Am I wrong?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Correct, this script only allows 2 active players per IP (not counting @autotrade).

So if everyone at a LAN house has the same public IP, only 2 can play.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

nothing happened, no errors , but dont work....i have 5 @at merchants and 2 accounts connected in same time...nobody is kicked.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Are they GM Lvl 99s? Because, if they are, they won't get kicked.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

nops, all normal player, =(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

if (getgmlevel() > 99) end;

Isn't 99 the maximum GM level? xD

Correct, this script only allows 2 active players per IP (not counting @autotrade).

So if everyone at a LAN house has the same public IP, only 2 can play.

I can be wrong but I remember those kind of sql ip checking scripts had problems with Internet Cafè's as well...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

nothing happened, no errors , but dont work....i have 5 @at merchants and 2 accounts connected in same time...nobody is kicked.

Oh I thought you wanted to allow 2 active players, and the 3rd to login would be kicked.

Here is the edited script that only allows 1 active player per IP (no limit on @autotrade merchants).

-	script	Only1perIP	-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$) >= 1) {
	for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
		if (checkvending(.@name$[.@i]) != 2)
			set .@sameip, .@sameip +1;
	}
	if (.@sameip >= 1) {
		announce "Sorry, only 1 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


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Are you using rAthena r16957 or later? (required for the getcharip script command)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

humm..ok updating....

great job, worked well in the last update, thank you for the patience..

regards and thanks again.

nothing happened, no errors , but dont work....i have 5 @at merchants and 2 accounts connected in same time...nobody is kicked.

Oh I thought you wanted to allow 2 active players, and the 3rd to login would be kicked.

Here is the edited script that only allows 1 active player per IP (no limit on @autotrade merchants).

-	script	Only1perIP	-1,{
OnPCLoginEvent:
if (getgmlevel() >= 99) end;
set .@name$, 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$) >= 1) {
	for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
		if (checkvending(.@name$[.@i]) != 2)
			set .@sameip, .@sameip +1;
	}
	if (.@sameip >= 1) {
		announce "Sorry, only 1 accounts per IP can be logged in at a time.", bc_self;
		sleep 1000;
		atcommand "@kick " + .@name$;
	}
}
end;
}

me again...

I actually have more players in lan house than I imagined, someone could change this query to read a field called last_mac,

would be the same system, only to read the last_mac not ip field.

once again sorry for my bad english.

Edited by eliandrotc
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

-	script	Only1perMAC	-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_mac=(SELECT last_mac FROM login WHERE account_id="+getcharid(3)+") AND `char`.online=1 AND `char`.char_id!="+getcharid(0), .@name$) >= 1) {
	for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
		if (checkvending(.@name$[.@i]) != 2)
			set .@samemac, .@samemac +1;
	}
	if (.@samemac >= 1) {
		announce "Sorry, only 1 account per computer can be logged in at a time.", bc_self;
		sleep 1000;
		atcommand "@kick " + .@myname$;
	}
}
end;
}

Edited by Brian
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

Brian, if he uses Harmony he can just edit the config file to reject mutli clients.

Edited by garet999
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  13
  • Reputation:   0
  • Joined:  09/01/12
  • Last Seen:  

Brian, if he uses Harmony he can just edit the config file to reject mutli clients.

yes, I know, but I want to make two maps with dual client enabled.

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

@at merchants were kicked,

only one char can stay logged...no matter the @at.

when I connect two chars, the first to be kicked is at @

any idea???

tks.

Edited by eliandrotc
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  161
  • Reputation:   31
  • Joined:  12/06/11
  • Last Seen:  

Thats because the script triggers upon login, it does the check right away :P. weird though, looking atit it should work fine.

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

edit:

	if (.@samemac >= 1) {

is greater than or equal to one, thus will always kick the player :P. Also, doesn't it kick the player because .@name$ is also the Array name?

Edited by garet999
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Also, doesn't it kick the player because .@name$ is also the Array name?

oops you're right, thanks garet!

Edited by Brian
fixed in previous posts
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...