Jump to content
  • 0

How to prohibit multi-client in a map?


johnbond

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

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.

Link to comment
Share on other sites

16 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

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?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

OnInit:

 

 

setarray .prohibitedmaps$[0],"mapname1","mapname2";
Edited by benching
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

OnInit:

 

 

setarray .prohibitedmaps$[0],"mapname1","mapname2";

 

 

Thanks! +1 to you.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  02/16/16
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

check for console errors,
also make sure to change the spaces to tabs in this line:

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  02/16/16
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  92
  • Reputation:   4
  • Joined:  06/21/15
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

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

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   1
  • Joined:  08/06/15
  • Last Seen:  

Sql code is not going through. Please help

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   1
  • Joined:  08/06/15
  • Last Seen:  

I try it through manual and this is the error that i'm getting

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   1
  • Joined:  08/06/15
  • Last Seen:  

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;

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

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 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   1
  • Joined:  08/18/13
  • Last Seen:  

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;

}

Link to comment
Share on other sites

  • -2

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  05/03/13
  • Last Seen:  

@masterzeus i have solution for this, if you are looking forward to have the script, feel free to pm mere. no worries its FREE found it on rathena and do a minor edit

Edited by diamondhole
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
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.

×
×
  • Create New...