Jump to content
  • 0

How to prohibit multi-client in a map?


Question

Posted

Is there a way to prohibit multiple client in battelgrounds or in any other map?

 

Maybe a script that can sense multi-client and warp player out if came from the same PC? I use gepard and it has an added row in login table named `last_unique_id` which is somewhat similar to mac address on the last row. Maybe we can incorporate this to the script and use this to check multi-client?

 

Can somebody make this script for me?

 

Let us not use IP screening because most of my players play in a single IP.

 

Thank you guys.

16 answers to this question

Recommended Posts

  • 0
Posted (edited)

Check to see if this will work, (PS: i dont have testserver to check if this thing works)

 

-	script	map multiclient checker	-1,{

OnPCLoadMapEvent:
	if(getgmlevel() >= 90){
		end;
	}
	query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
	getmapxy @map$,@x,@y,0;
	for (set .@i,0; .@i < getarraysize(.prohibitedmaps$); set .@i,.@i+1){
		if ( @map$ == .prohibitedmaps$[.@i] ){
			set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1 AND `mapname` = `"+ @map$+"";
			if(@hmc > 0){
				warp "prontera",0,0;	// warp back
				dispbottom "MultiClient not allowed on "+@map$,0;
				end;
			}else if(@hmc == 0){
				query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 1, `mapname` = `"+ @map$ +"` WHERE `u_id` = `"+ @lud +";";
				end;
			}else{
				dispbottom "Unknown Error Occured, Please Report this to Administrator!",0xFF0000;
				end;
			}
		}
	}
	query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnPCLogOutEvent:
	query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
	set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1";
	query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnInit:
	setarray .prohibitedmaps$[0],"mapname1","mapname2";
	query_sql "CREATE TABLE IF NOT EXIST `no_multi_map` (`mapname` TEXT NOT NULL, `u_id` TEXT NOT NULL, `hasClient` UNSIGNED INT NOT NULL) ENGINE=MyISAM";
end;

}

 

Modify it, to fit your needs.

Edited by benching
  • 0
Posted

Check to see if this will work, (PS: i dont have testserver to check if this thing works)

-	script	map multiclient checker	-1,{

OnPCLoadMapEvent:
	if(getgmlevel() >= 90){
		end;
	}
	query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
	getmapxy @map$,@x,@y,0;
	for (set .@i,0; .@i < getarraysize(.prohibitedmaps$); set .@i,.@i+1){
		if ( @map$ == .prohibitedmaps$[.@i] ){
			set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1 AND `mapname` = `"+ @map$+"";
			if(@hmc > 0){
				warp "prontera",0,0;	// warp back
				dispbottom "MultiClient not allowed on "+@map$,0;
				end;
			}else if(@hmc == 0){
				query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 1, `mapname` = `"+ @map$ +"` WHERE `u_id` = `"+ @lud +";";
				end;
			}else{
				dispbottom "Unknown Error Occured, Please Report this to Administrator!",0xFF0000;
				end;
			}
		}
	}
	query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnPCLogOutEvent:
	query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
	set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1";
	query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnInit:
	setarray .prohibitedmaps$[0],"mapname1","mapname2";
	query_sql "CREATE TABLE IF NOT EXIST `no_multi_map` (`mapname` TEXT NOT NULL, `u_id` TEXT NOT NULL, `hasClient` UNSIGNED INT NOT NULL) ENGINE=MyISAM";
end;

}

Modify it, to fit your needs.

Thanks for this. Where can i put the list of maps this script will check?

  • 0
Posted (edited)

Why its not working on my side?
im using rathena and my gameguard is harmony.

Btw, can you edit this into per mac, not per IP.
because if a player plays in a computer cafe they will get kicked out of the map.


and im using this.

-    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.";
                warp "geffen",0,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 ;
}

Edited by lanblakebea
  • 0
Posted

check for console errors,

also make sure to change the spaces to tabs in this line:

-<tab>script<tab>map multiclient checker<tab>-1,{

Done that.

Kind sir, can you modify this like, if you use dual account in kh_mansion the other one will disconnect. and we will check it per Mac not Per IP.

  • 0
Posted

check the table structure of the login table, in your database.

if you have last_mac as column, go copy my script above,
and change this line:
 

 

 

query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);

to this line
 

 

 

query_sql("SELECT `last_mac` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
  • Upvote 1
  • 0
Posted (edited)

Hello. i have a problem. error in line's 11

 

- script map multiclient checke -1,{

OnPCLoadMapEvent:
if(getgmlevel() >= 99){
end;
}
query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
getmapxy @map$,@x,@y,0;
for (set .@i,0; .@i < getarraysize(.prohibitedmaps$); set .@i,.@i+1){
if ( @map$ == .prohibitedmaps$[.@i] ){
set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1 AND `mapname` = `"+ @map$+"";
if(@hmc > 0){
warp "prontera",0,0; // warp back
dispbottom "MultiClient not allowed on "+@map$,0;
end;
}else if(@hmc == 0){
query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 1, `mapname` = `"+ @map$ +"` WHERE `u_id` = `"+ @lud +";";
end;
}else{
dispbottom "MultiClient is not Allowed!",0xFF0000;
end;
}
}
}
query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnPCLogOutEvent:
query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1";
query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnInit:
setarray .prohibitedmaps$[0],"ordeal_1-1";
query_sql "CREATE TABLE IF NOT EXIST `no_multi_map` (`mapname` TEXT NOT NULL, `u_id` TEXT NOT NULL, `hasClient` UNSIGNED INT NOT NULL) ENGINE=MyISAM";
end;

}
Edited by Emistry
use codebox
  • 0
Posted
set @hmc, query_sql "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1 AND `mapname` = `"+ @map$+"";

change to

set @hmc, query_sql( "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1 AND `mapname` = `"+ @map$ );
  • Upvote 1
  • 0
Posted
Spoiler

mh9e8n.png

3rd act = I have successfully created a query but thing now the logs wont get through the database.

CREATE TABLE  `no_multi_map` (
`mapname` TEXT NOT NULL,
 `u_id` TEXT NOT NULL,
 `hasClient` INT UNSIGNED NOT NULL DEFAULT 0 ) 
ENGINE = MYISAM;

  • 0
Posted

When using text in an sql check you need to use 'text' and not `text`, you can only skip the ' when it's an number values and be sure to end it also with ' too.

Like `"+@map); > '"+@map$+"'");

That's why you get that syntax error.

` = table 

' = table value

Correct usage:

`mapname` = '"+ @map$ +"'");

Regards, 

Chris 

  • 0
Posted
On 15/10/2017 at 10:53 AM, llchrisll said:

When using text in an sql check you need to use 'text' and not `text`, you can only skip the ' when it's an number values and be sure to end it also with ' too.

Like `"+@map); > '"+@map$+"'");

That's why you get that syntax error.

` = table 

' = table value

Correct usage:


`mapname` = '"+ @map$ +"'");

Regards, 

Chris 

i cant 

 

-    script    map multiclient checker    -1,{

OnPCLoadMapEvent:
    if(getgmlevel() >= 100){
        end;
    }
    query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
    getmapxy @map$,@x,@y,0;
    for (set .@i,0; .@i < getarraysize(.prohibitedmaps$); set .@i,.@i+1){
        if ( @map$ == .prohibitedmaps$[.@i] ){
            set @hmc, query_sql( "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1 AND `mapname` = `"+ @map$ );
            if(@hmc > 0){
                warp "prontera",155,159;    // warp back
                dispbottom "No puedes usar DL en el mapa "+@map$,0;
                end;
            }else if(@hmc == 0){
                query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 1, `mapname` = `"+ @map$ +"` WHERE `u_id` = `"+ @lud +";";
                end;
            }else{
                dispbottom "Ocurrio un error inesperado, comunicate con un administrador.",0xFF0000;
                end;
            }
        }
    }
    query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnPCLogOutEvent:
    query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = "+getcharid(3)+"",@lud);
    set @hmc, query_sql( "SELECT * FROM `no_multi_map` WHERE `u_id` = `"+ @lud +" AND `hasClient` = 1" );
    query_sql "UPDATE TABLE `no_multi_map` SET `hasClient` = 0 WHERE `u_id` = `"+ @lud +" AND `mapname` = `"+ @map$+"";
end;

OnInit:
    setarray .prohibitedmaps$[0],"pvp_y_room";
    //query_sql "CREATE TABLE IF NOT EXIST `no_multi_map` (`mapname` TEXT NOT NULL, `u_id` TEXT NOT NULL, `hasClient` UNSIGNED INT NOT NULL) ENGINE = MYISAM;";
end;

}

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