Nokia Posted February 12, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 150 Reputation: 5 Joined: 12/28/11 Last Seen: May 10, 2013 Share Posted February 12, 2012 Hi, im searching for an IP Check Script, maybe an "onpcloginevent" script, i wanna kick players which are already logged on with 3 other accounts, like this: OnPCLoginEvent: if > players ip is 3 times logged in kick else end: possible? Quote Link to comment Share on other sites More sharing options...
herenow Posted February 12, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 36 Reputation: 4 Joined: 02/12/12 Last Seen: January 25, 2017 Share Posted February 12, 2012 yep. Use something like OnPCLoginEvent: query_sql("SELECT COUNT(*) FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id` = "+getcharid(3)+")",.@count); if( .@count >= 3 ) { atcommand "@kick "+strcharinfo(0); } Quote Link to comment Share on other sites More sharing options...
Nokia Posted February 12, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 150 Reputation: 5 Joined: 12/28/11 Last Seen: May 10, 2013 Author Share Posted February 12, 2012 hm there must be something wrong, if i logged in with 3 accounts, im getting kicked everytime no matter how much accounts are online. i also restarted the server, if i login with 1 account > kick Quote Link to comment Share on other sites More sharing options...
Brian Posted February 12, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted February 12, 2012 SELECT COUNT() FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id` = "+getcharid(3)+") The SQL query herenow posted actual does this: "count how many accounts in the `login` table have the same IP as you" instead, it should be: "count how many online chars have the same IP as you" SELECT COUNT(char_id) FROM `char` LEFT JOIN `login` ON `char`.account_id=login.account_id WHERE online AND last_ip = (SELECT `last_ip` FROM `login` WHERE `account_id` = "+getcharid(3)+") Example: only3perIP.txt Quote Link to comment Share on other sites More sharing options...
Nokia Posted February 12, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 150 Reputation: 5 Joined: 12/28/11 Last Seen: May 10, 2013 Author Share Posted February 12, 2012 (edited) yea its working, but i have to change the .count into 4, because i can only have 2 accounts online if i count 3, buts its working. edit: nvm, its working in your example Edited February 12, 2012 by Nokia Quote Link to comment Share on other sites More sharing options...
herenow Posted February 12, 2012 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 36 Reputation: 4 Joined: 02/12/12 Last Seen: January 25, 2017 Share Posted February 12, 2012 Sorry my bad. Use this code OnPCLoginEvent: query_sql("SELECT COUNT(char_id) FROM `char` LEFT JOIN `login` ON `char`.account_id=login.account_id WHERE online AND last_ip = (SELECT `last_ip` FROM `login` WHERE `account_id` = "+getcharid(3)+")",.@count); if( .@count > 3 ) { atcommand "@kick "+strcharinfo(0); } Quote Link to comment Share on other sites More sharing options...
Nokia Posted February 15, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 150 Reputation: 5 Joined: 12/28/11 Last Seen: May 10, 2013 Author Share Posted February 15, 2012 can i request a check for autotraders? if 3 autotraders are online i cant login anymore :/ Quote Link to comment Share on other sites More sharing options...
Landb4Time Posted February 23, 2012 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 76 Reputation: 0 Joined: 01/16/12 Last Seen: July 5, 2014 Share Posted February 23, 2012 Brian can i request Checking I P when entering a Map and kick if dual .. example map bat_room . I want to use this for BG . Quote Link to comment Share on other sites More sharing options...
Brian Posted February 23, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted February 23, 2012 // http://rathena.org/board/topic/58835-done-request-ip-check/page__view__findpost__p__80798 // Checking I P when entering a Map and kick if dual .. example map bat_room - script Only1perIP -1,{ OnPCLoadMapEvent: set .maps$, "bat_room,anothermap,etc"; set .@my_map$, strcharinfo(3); // check if they are on a "1-per-IP" map if (compare(","+.maps$+"," , ","+.@my_map$+",")) { // look for other online players from the same IP 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 AND login.account_id!="+getcharid(3), .@account_id; for (set .@i,0; .@i<getarraysize(.@account_id); set .@i,.@i+1) { // check if other online players are on the same map getmapxy .@map$,.@x,.@y, 0, rid2name(.@account_id[.@i]); if (.@map$ == .@my_map$) { // kick the new player arriving to map set .@name$, strcharinfo(0); announce "Sorry, only 1 char per IP can be on this map at a time.", bc_self; sleep 1000; atcommand "@kick " + .@name$; } } } end; } bat_room mapflag loadevent To add more maps: 1. add it to this string set .maps$, "bat_room,anothermap,etc"; 2. and add the 'loadevent' mapflag on that map <map name> mapflag loadevent Quote Link to comment Share on other sites More sharing options...
Landb4Time Posted February 23, 2012 Group: Members Topic Count: 32 Topics Per Day: 0.01 Content Count: 76 Reputation: 0 Joined: 01/16/12 Last Seen: July 5, 2014 Share Posted February 23, 2012 its not working Im using eathena r15074m Quote Link to comment Share on other sites More sharing options...
Santino Posted October 8, 2012 Group: Members Topic Count: 25 Topics Per Day: 0.01 Content Count: 198 Reputation: 47 Joined: 08/01/12 Last Seen: July 1, 2015 Share Posted October 8, 2012 can i request a check for autotraders? if 3 autotraders are online i cant login anymore :/ hmm. looking for this one too. =O tried checkvending. =( Quote Link to comment Share on other sites More sharing options...
Question
Nokia
Hi, im searching for an IP Check Script, maybe an "onpcloginevent" script, i wanna kick players
which are already logged on with 3 other accounts, like this:
OnPCLoginEvent:
if > players ip is 3 times logged in
kick
else
end:
possible?
Link to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.