viewing paste Unknown #33 | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
-   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
set .@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
Viewed 1599 times, submitted by Streusel.