If you only want to allow 1 char per IP in a certain map, you could do something like this:
prontera,155,188,0 script TestNPC 910,{
if (callfunc("has_char_from_same_ip", "guild_vs2")) {
mes "There is already a char from your IP on guild_vs2.";
} else {
warp "guild_vs2",0,0;
}
close;
}
function script has_char_from_same_ip {
set .@my_map$, getarg(0);
// get array of char names who are online from the same IP
query_sql "SELECT `char`.`name` FROM `char` LEFT JOIN login ON `char`.account_id=login.account_id " +
"WHERE last_ip=(SELECT last_ip FROM login WHERE account_id="+playerattached()+") AND online AND `char`.account_id!=" + playerattached(), .@name$;
// check each char, and see if they are on the map
for (set .@i,0; .@i < getarraysize(.@name$); set .@i,.@i+1) {
getmapxy .@map$, .@x, .@y, 0, .@name$[.@i];
if (.@map$ == .@my_map$)
return 1; // another char from this IP is already on map
}
return 0; // no other chars from this IP are on that map
}