Duel login restriction for some maps

caspe

New member
Messages
146
Points
0
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.

-    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


 
Hey, I think this may help:

- 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

 
Last edited by a moderator:
Thank your for reply, 

Well server has .@go command

i will test this and post results. 

 
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

 
Back
Top