- poring_c01,100,100,0 script test 910,{
- if (callfunc("has_char_from_same_ip")) {
- mes "There is already a char from your IP in Battlegrounds.";
- } else {
- mes "You may enter BG.";
- }
- close;
- }
- function script has_char_from_same_ip {
- set .bg_maps$, "schg_cas06,schg_cas07,schg_cas08,arug_cas06,arug_cas07," +
- "arug_cas08,rush_cas01,rush_cas02,rush_cas03,rush_cas04," +
- "bat_room,prt_are01,job3_war01,job3_war02," +
- "job3_sha01,job3_rang01,job3_arch01,job3_rune02,job3_guil01," +
- "bat_a01,bat_a02,bat_b01,bat_b02,bat_c01,bat_c02,bat_c03," +
- "2@cata,force_1-1,force_2-1,force_3-1,force_1-3,job3_arch03";
- // check whitelist
- for (set .@i,0; .@i<getarraysize($bgexceptions); set .@i,.@i+1) {
- if (getcharid(3) == $bgexceptions[.@i])
- return 0; // always allow
- }
- // 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 a BG map
- for (set .@i,0; .@i<getarraysize(.@name$); set .@i,.@i+1) {
- getmapxy .@map$, .@x, .@y, 0, .@name$[0];
- if (compare(.bg_maps$, .@map$))
- return 1; // another char from this IP is on map
- }
- return 0; // no other chars from this IP on that map
- }
has_char_from_same_ip
Posted by Anonymous on Tue 10th Apr 2012 17:47
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
rathena.kpaste.net RSS