Jump to content
  • 0
caspe

Duel login restriction for some maps

Question

Hello i need help with this Duel Login check script

Currently whenever i enter turbo_room with dual accounts logged in, it kicks me out.

------------------------------------------------------------------------------------------------------------------------------------

What i want

Even if user has dual account logged in, it should allow at list one character to stay on turbo_room.

Spoiler

-    script    dualcheckkk    -1,{

OnPCLoadMapEvent:
getmapxy @map$,@x,@y,0;
if (@map$ == "turbo_room")
{
    query_sql( "SELECT `last_ip` FROM `login` WHERE account_id="+getcharid(3)+"",.@IP );
    query_sql( "SELECT `account_id` FROM `login` WHERE last_ip="+.@IP+"",.@Accountlist );
    for( set .@i,0; .@i < getarraysize( .@Accountlist );
    set .@i,.@i + 1 )    if( isloggedin( .@Accountlist[.@i] ) )
        set .@DetectedOnline,.@DetectedOnline + 1;
        if(.@DetectedOnline > 1){
        mes "We detected there is "+.@DetectedOnline+" Users with same IP Logged in.";
        mes "Please log off these unused account.";
        close2;
        warp "prontera",155,181;
    }
}
end;
}


turbo_room    mapflag    loadevent

 

I'm also getting this message in Map-server, hope some one will help.

CNdqmCH.jpg

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hey, I think this may help:

Spoiler

-	script	::dual_check	FAKE_NPC,{
OnInit:
	//-- Configuration
	.VerifiedMap$ = "turbo_room";  ///< The map where we will verify for same ip
	.Message$     = _("You can access this map with only account per IP."); ///< Message that will be displayed
	.WarpMap$     = "prontera";    ///< The map where we will warp the player if it is a dual account
	.WarpX        = 155;           ///< X coordinate to warp the character
	.WarpY        = 181;           ///< Y coordinate to warp the character
	

	//-- Initialization
	deletearray(.IP_List$[0], getarraysize(.IP_List$));
	end();
OnPCLoadMapEvent:
	if (strcharinfo(PC_MAP) != .VerifiedMap$)
		end();

	.@ip$ = getcharip();
	for (.@i = 0; .@i < getarraysize(.IP_List$); .@i++) {
		if (.@ip$ != .IP_List$[.@i])
			continue;

		warp(.WarpMap$, .WarpX, .WarpY, false); // 4th argument will prevent ending the script
		dispbottom(.Message$, 0xFF0000);
		end();
	}

	// If it got this far it's a new IP
	.IP_List$[getarraysize(.IP_List$)] = .@ip$;
	end();

OnPCLogoutEvent:
	if (strcharinfo(PC_MAP) != .VerifiedMap$)
		end();
	
	.@ip$ = getcharip();
	for (.@i = 0; .@i < getarraysize(.IP_List$); .@i++) {
		if (.@ip$ != .IP_List$[.@i])
			continue;

		// Assuming that will be only 1 match on the whole array.
		deletearray(.IP_List$[.@i], 1);
		end();
	}
}

 

but notice that it will only work if the only way to get out of this map is through disconnecting (logout).

Is there any other way to get out of this map on your server?

 

@edit:

I almost forgot the warnings you got. You need to increase the value of MAX_EVENTQUEUE inside map.h

O
Edited by Murilo BiO'

Share this post


Link to post
Share on other sites
  • 0

so you should apply a mapflag to prevent use of @go and I don't know, maybe add a portal that will call the last part of the script to remove the IP from the list.

Otherwise it will block this ip forever haha

Share this post


Link to post
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
Answer this question...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.