Jump to content

No triple accounts on certain map.


Recommended Posts


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.02
  • Content Count:  40
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

Good day, in my script i encounter this error. I can't find a way to fix.

image.png.89448c5521da12c1404339a87233600e.png

-    script    Gold_Room_Max_Account    -1,{

    OnPCLoadMapEvent:

        if(getgmlevel() >= 99){

            end;

        }

        set .@charmap$, strcharinfo(3);

        if(!compare(.tmp$, .@charmap$)) end;

        set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `ragnarok_accounts`.`login` WHERE `last_ip` = (SELECT `last_ip` FROM `ragnarok_accounts`.`login` WHERE `account_id` = "+getcharid(3)+")) AND `online` <> 0;",.@a);

        for(set(.@d,0); .@d < .@len; set(.@d, .@d+1)) {

            if(!getmapxy(.@map$, .@x, .@y, BL_PC, rid2name(.@a[.@d])) && .@charmap$ == .@map$)

                set .@c, .@c + 1;     

        }

        if(.@c > .limitacc ) {

            dispbottom "Maximum of 2 accounts are allowed in the Gold Room at a time!";

            warp "thana_town", 100, 100;

        }    

        end;

    OnInit:

        set .limitacc, 2;

        setarray .maps$, "rockrdg1";

        set .lens, getarraysize(.maps$);

        for(set(.a, 0); .a < .lens; set(.a, .a+1)) {

            setmapflag .maps$[.a], mf_loadevent;

            set .tmp$, .tmp$ + .maps$[.a] + ",";

        }

}

 

Edited by Mael
Use a codebox
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

for (.@d = 0; .@d < .@len; .@d++) {
	if (!isloggedin(.@a[.@d]))
		continue;
    if (!getmapxy(.@map$, .@x, .@y, BL_PC, rid2name(.@a[.@d])) && .@charmap$ == .@map$)
        set .@c, .@c + 1;     
}

you can try add something like this to skip offline players

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
Reply to this topic...

×   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...