Jump to content
  • 0

block double account certain maps


Question

Posted

Hi, I use gepard on my server, and I wanted to block the same person from accessing the same map with two accounts. I tried to change the last_ip to last_unique_id, but it blocks all people from accessing the map if there is already a person in it.

 

-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
	set .@charmap$, strcharinfo(3);
	query_sql("SELECT FIND_IN_SET('"+.@charmap$+"', '"+.maps$+"');",.@q);
	if(.@charmap$!=.tmp$[(.@q-1)]) end;
	set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND `online` <> 0;",.@a);
	if(.@len-1) {
		for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
			getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d]));
			if(.tmp$[(.@q-1)]==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) {
				dispbottom "Duel accounts not allowed in WOE.";
				atcommand "@kick "+strcharinfo(0);
			}
		}
	}
	end;
	
OnInit:
	set        .maps$  ,	"aldeg_cas01,gefg_cas01,payg_cas01,prtg_cas01";
	explode(   .tmp$   ,    .maps$, ",")                                  ;
	set        .lens   ,	getarraysize(.tmp$)                           ;
	for(set .a,0;.a<.lens;set .a,.a+1)
		setmapflag .tmp$[.a],	mf_loadevent ;
}

 

2 answers to this question

Recommended Posts

  • 1
Posted
1 hour ago, guhx said:

Hi, I use gepard on my server, and I wanted to block the same person from accessing the same map with two accounts. I tried to change the last_ip to last_unique_id, but it blocks all people from accessing the map if there is already a person in it.

 


-	script	dualclientkicker	-1,{
OnPCLoadMapEvent:
	set .@charmap$, strcharinfo(3);
	query_sql("SELECT FIND_IN_SET('"+.@charmap$+"', '"+.maps$+"');",.@q);
	if(.@charmap$!=.tmp$[(.@q-1)]) end;
	set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` = (SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND `online` <> 0;",.@a);
	if(.@len-1) {
		for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
			getmapxy(.@map$,.@x,.@y,0,rid2name(.@a[.@d]));
			if(.tmp$[(.@q-1)]==.@map$&&rid2name(.@a[.@d])!=strcharinfo(0)) {
				dispbottom "Duel accounts not allowed in WOE.";
				atcommand "@kick "+strcharinfo(0);
			}
		}
	}
	end;
	
OnInit:
	set        .maps$  ,	"aldeg_cas01,gefg_cas01,payg_cas01,prtg_cas01";
	explode(   .tmp$   ,    .maps$, ",")                                  ;
	set        .lens   ,	getarraysize(.tmp$)                           ;
	for(set .a,0;.a<.lens;set .a,.a+1)
		setmapflag .tmp$[.a],	mf_loadevent ;
}

 

here you go, please tick it as answer and upvote it :)

-	script	dualclientkicker	-1,{
	end;
OnPCLoadMapEvent:
	//debugmes "map loaded";
	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$;
	for ( .@i = 0; .@i < getarraysize ( .@name$ ); .@i = .@i++ ) {
		getmapxy .@map$, .@x, .@y, 0, .@name$[.@i];
		if ( .@map$ == .current_maps$ ) {
			dispbottom "Duel accounts not allowed in this map.";
			warp "SavePoint" , 0 , 0;
			end;
		}
	}
	end;
	
OnInit:
	setarray .current_maps$[0] , "prontera" , "geffen", "gef_fild00";
	.size_maps = getarraysize ( .current_maps$ );
	for ( .i = 0; .i < .size_maps; .i++)
		setmapflag .current_maps$[.i],	mf_loadevent ;
	end;
}

 

  • Upvote 1

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...