Jump to content
  • 0
Helena

Help me run this script on multiple maps please.

Question

Hello. I have a script that works perfect but it only works on one map. I was wondering if someone could help me make it work on several maps? Someone in rA tried to provide me a solution, but it did not work.

 

it currently only runs on map "arena", but i want it to also run on prtg_cas01

 

this is the script:

 

Thank you so much Hercules!

 

 

-	script	BG_Check_IP	-1,{OnInit:	setmapflag "arena", mf_loadevent;	set .whitelist$, "| 127.0.0.1 | 127.0.0.2 | etc";	end;// Trigger when a player enters a map with "loadevent" mapflag.OnPCLoadMapEvent:	// Only run for map "arena".	if (strcharinfo(3) != "arena") end;		set .@my_ip$, getcharip();	if ( compare( .@my_ip$, .whitelist$ ) ) end;	// Get list of accounts with attached character's IP address.	set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);	// Passed check if only the attached player is returned.	if (.@size < 2) end;	// Check all online characters using the IP address if they are on a Battlegrounds map.	set .@self, getcharid(3);	for(set .@i,0; .@i<.@size; set .@i,.@i+1) {		if (.@aid[.@i] == .@self)			continue;		if (attachrid(.@aid[.@i])) {			if (compare(strcharinfo(3),"arena")) {				set .@name$, strcharinfo(0);				attachrid(.@self);				message strcharinfo(0),"Character "+.@name$+" is already present in this map with your IP. Kicking....";				sleep2 2000;	atcommand "@kick "+strcharinfo(0);				end;			}		}	}	// Passed check.	end;}

 

 

 

 

Share this post


Link to post
Share on other sites

19 answers to this question

Recommended Posts

  • 0

 

Hello. I have a script that works perfect but it only works on one map. I was wondering if someone could help me make it work on several maps? Someone in rA tried to provide me a solution, but it did not work.

 

it currently only runs on map "arena", but i want it to also run on prtg_cas01

 

this is the script:

 

Thank you so much Hercules!

 

 

-	script	BG_Check_IP	-1,{OnInit:	setmapflag "arena", mf_loadevent;	set .whitelist$, "| 127.0.0.1 | 127.0.0.2 | etc";	end;// Trigger when a player enters a map with "loadevent" mapflag.OnPCLoadMapEvent:	// Only run for map "arena".	if (strcharinfo(3) != "arena") end;		set .@my_ip$, getcharip();	if ( compare( .@my_ip$, .whitelist$ ) ) end;	// Get list of accounts with attached character's IP address.	set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);	// Passed check if only the attached player is returned.	if (.@size < 2) end;	// Check all online characters using the IP address if they are on a Battlegrounds map.	set .@self, getcharid(3);	for(set .@i,0; .@i<.@size; set .@i,.@i+1) {		if (.@aid[.@i] == .@self)			continue;		if (attachrid(.@aid[.@i])) {			if (compare(strcharinfo(3),"arena")) {				set .@name$, strcharinfo(0);				attachrid(.@self);				message strcharinfo(0),"Character "+.@name$+" is already present in this map with your IP. Kicking....";				sleep2 2000;	atcommand "@kick "+strcharinfo(0);				end;			}		}	}	// Passed check.	end;}

set mapflags with loadevent on the maps you want.

either below the

 

 setmapflag "arena", mf_loadevent; 

just change arena, and put other entries.

or set mapflag via mapflag command, at very end(after the last } ) by

mapname<tab>mapflag<tab>loadevent

also edit this line

 

if (strcharinfo(3) != "arena") end;

to 

 

if (strcharinfo(3) != "arena" || strcharinfo(3) != "othermapname") end; 

and so on.

Edited by Dastgir Pojee

Share this post


Link to post
Share on other sites
  • 0

Thanks Dastgir, what about this line though?

          if (compare(strcharinfo(3),"arena")) {

-    script    BG_Check_IP    -1,{OnInit:    setmapflag "arena", mf_loadevent;	setmapflag "othermap", mf_loadevent;    set .whitelist$, "| 127.0.0.1 | 127.0.0.2 | etc";    end;// Trigger when a player enters a map with "loadevent" mapflag.OnPCLoadMapEvent:    // Only run for map "arena".    if (strcharinfo(3) != "arena" || strcharinfo(3) != "othermap") end;	set .@map$,strcharinfo(3);        set .@my_ip$, getcharip();    if ( compare( .@my_ip$, .whitelist$ ) ) end;    // Get list of accounts with attached character's IP address.    set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);    // Passed check if only the attached player is returned.    if (.@size < 2) end;    // Check all online characters using the IP address if they are on a Battlegrounds map.    set .@self, getcharid(3);    for(set .@i,0; .@i<.@size; set .@i,.@i+1) {        if (.@aid[.@i] == .@self)            continue;        if (attachrid(.@aid[.@i])) {            if (compare(strcharinfo(3),.@map$)) {                set .@name$, strcharinfo(0);                attachrid(.@self);                message strcharinfo(0),"Character "+.@name$+" is already present in this map with your IP. Kicking....";                sleep2 2000;    atcommand "@kick "+strcharinfo(0);                end;            }        }    }    // Passed check.    end;}

It will restrict players with same IP on Same Map

Share this post


Link to post
Share on other sites
  • 0

 

Thanks Dastgir, what about this line though?

          if (compare(strcharinfo(3),"arena")) {

-    script    BG_Check_IP    -1,{OnInit:    setmapflag "arena", mf_loadevent;	setmapflag "othermap", mf_loadevent;    set .whitelist$, "| 127.0.0.1 | 127.0.0.2 | etc";    end;// Trigger when a player enters a map with "loadevent" mapflag.OnPCLoadMapEvent:    // Only run for map "arena".    if (strcharinfo(3) != "arena" || strcharinfo(3) != "othermap") end;	set .@map$,strcharinfo(3);        set .@my_ip$, getcharip();    if ( compare( .@my_ip$, .whitelist$ ) ) end;    // Get list of accounts with attached character's IP address.    set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);    // Passed check if only the attached player is returned.    if (.@size < 2) end;    // Check all online characters using the IP address if they are on a Battlegrounds map.    set .@self, getcharid(3);    for(set .@i,0; .@i<.@size; set .@i,.@i+1) {        if (.@aid[.@i] == .@self)            continue;        if (attachrid(.@aid[.@i])) {            if (compare(strcharinfo(3),.@map$)) {                set .@name$, strcharinfo(0);                attachrid(.@self);                message strcharinfo(0),"Character "+.@name$+" is already present in this map with your IP. Kicking....";                sleep2 2000;    atcommand "@kick "+strcharinfo(0);                end;            }        }    }    // Passed check.    end;}

It will restrict players with same IP on Same Map

 

Not working. No error on the map server just not warping me... /hmm

Share this post


Link to post
Share on other sites
  • 0

It should kick you, if other player from same ip is on that map..

also be sure you didnt test from local server, since whitelist contains localhost ip, so you wont be kicked if connected on local test server.

Share this post


Link to post
Share on other sites
  • 0

Yes sorry jaBote, I meant kicking.

 

 

It should kick you, if other player from same ip is on that map..
also be sure you didnt test from local server, since whitelist contains localhost ip, so you wont be kicked if connected on local test server.

 

I've tested it on live server, but doesn't kick characters.

I'll try again later after another server restart and I'll report back.

Share this post


Link to post
Share on other sites
  • 0

This may sound stupid but... You changed the "othermap" name to prtg_cas01?

 

BTW if I were you I'd make a copy of the script only to work with the castle, this way... you wouldn't get accidentally kicked by having an account on WoE and another on BG?

Share this post


Link to post
Share on other sites
  • 0

This may sound stupid but... You changed the "othermap" name to prtg_cas01?

 

BTW if I were you I'd make a copy of the script only to work with the castle, this way... you wouldn't get accidentally kicked by having an account on WoE and another on BG?

This won't happen..

since script sets a variable with map_name of character in it.

and attaches all rid, and checks if map_name matches.

So it would only check the users on same map with same IP

 

Also be sure, that you warped to that map after loading the script. (and if possible, show us what edits you actually did)

Share this post


Link to post
Share on other sites
  • 0

Here's the full script I use with your tweaks (it has tabs in the header but they dont appear in codebox):

 

 

-	script	BG_Check_IP	-1,{OnInit:	setmapflag "prtg_cas01", mf_loadevent;	setmapflag "job_sage", mf_loadevent;	setmapflag "job_knt", mf_loadevent;	set .whitelist$, "127.0.0.1";	end; // Trigger when a player enters a map with "loadevent" mapflag.OnPCLoadMapEvent:	 // Only run for these maps    if (strcharinfo(3) != "prtg_cas01" || strcharinfo(3) != "job_sage" || strcharinfo(3) != "job_knt") end;	set .@map$,strcharinfo(3);		set .@my_ip$, getcharip();	if ( compare( .@my_ip$, .whitelist$ ) ) end;	 // Get list of accounts with attached character's IP address.	set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);	 // Passed check if only the attached player is returned.	if (.@size < 2) end;	 // Check all online characters using the IP address if they are on maps.	set .@self, getcharid(3);	for(set .@i,0; .@i<.@size; set .@i,.@i+1) {		if (.@aid[.@i] == .@self)			continue;		if (attachrid(.@aid[.@i])) {			if (compare(strcharinfo(3),.@map$)) {				set .@name$, strcharinfo(0);				attachrid(.@self);				message strcharinfo(0),"Character "+.@name$+" is already present in this map with your IP. Kicking....";				sleep2 2000;	atcommand "@kick "+strcharinfo(0);				end;			}		}	}	 // Passed check.	end;}
Edited by Helena

Share this post


Link to post
Share on other sites
  • 0

Anyone? 

 

I need max. 2 ro clients per the whitelisted IPs, and in multiple maps too. This is a working version, but not with the tweaks i am looking for.

 

it currently allows unlimited connections and only works on 1 map! :(

 

 

-	script	WoE_IP_Kick	-1,{OnInit:	setmapflag "prtg_cas01", mf_loadevent;	set .whitelist$, "xx.xx.xx.xx | xx.xx.xx.xx";	end; // Trigger when a player enters a map with "loadevent" mapflag.OnPCLoadMapEvent:	 // Only run for map "prtg_cas01".if (strcharinfo(3) != "prtg_cas01") end;		set .@my_ip$, getcharip();	if ( compare( .@my_ip$, .whitelist$ ) ) end;	 // Get list of accounts with attached character's IP address.	set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);	 // Passed check if only the attached player is returned.	if (.@size < 2) end;	 // Check all online characters using the IP address if they are on a Battlegrounds map.	set .@self, getcharid(3);	for(set .@i,0; .@i<.@size; set .@i,.@i+1) {		if (.@aid[.@i] == .@self)			continue;		if (attachrid(.@aid[.@i])) {			if (compare(strcharinfo(3),"prtg_cas01")) {				set .@name$, strcharinfo(0);				attachrid(.@self);				message strcharinfo(0),"Character "+.@name$+" is already present in this map with your IP. Kicking....";				sleep2 2000;	atcommand "@kick "+strcharinfo(0);				end;			}		}	}	 // Passed check.	end;}
Edited by Helena

Share this post


Link to post
Share on other sites
  • 0

try this script
 

-	script	BG_Check_IP	-1,{OnInit:	.wlmaxw = 2;	setarray .check_ip_map$[0],"prtg_cas01","job_sage","job_knt";	setarray .whitelist$[0],"127.0.0.1","127.0.0.2";	.cimsize = getarraysize(.check_ip_map$);	.wlsize = getarraysize(.whitelist$);    	for(.@mf=0;.@mf<.cimsize;.@mf++)        	setmapflag .check_ip_map$[.@mf],mf_loadevent;end;OnPCLoadMapEvent:	.@emap$ = strcharinfo(3);	for(.@i=0;.@i<.cimsize;.@i++) {		if(.check_ip_map$[.@i]==.@emap$)			break;	}	if(.@i >= .cimsize) end;	set .@my_ip$, getcharip();	for(.@k=0;.@k<.wlsize;.@k++) {		if(.whitelist$[.@k]==.@my_ip$) {			.@wf=1;			break;		}	}	.@maxw = (.@wf ? .wlmaxw : 1 );    	// Get list of accounts with attached character's IP address.    	set .@size, query_sql("SELECT `account_id` FROM `login` WHERE `last_ip` = '"+ .@my_ip$ +"'",.@aid);	// Passed check if only the attached player is returned.	if (.@size <= .@maxw ) end;	.@self = getcharid(3);	for(.@j=0; .@j < .@size;.@j++) {        	if (attachrid(.@aid[.@j])) {            		if (strcharinfo(3) == .@emap$ )				.@w++;		}	}	if(.@w > .@maxw ) {		if (attachrid(.@self)) {			sleep2 2000;			//atcommand "@kick "+strcharinfo(0);			warp "SavePoint",0,0;		}	}end;}
Edited by Angelmelody

Share this post


Link to post
Share on other sites
  • 0

 

Hi angelmelody,

 

I tried your script. The mapsever says 'Unexpected end of script' at the last curly.

 

updated  try again

 

No bug now, but doesn't kick the third client.

Share this post


Link to post
Share on other sites
  • 0

 

 

 

 

Hi angelmelody,

 

I tried your script. The mapsever says 'Unexpected end of script' at the last curly.

 

updated  try again

 

 

 

No bug now, but doesn't kick the third client.

 

 

cuz your ip was in the whitelist 127.0.0.1 Edited by Angelmelody

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.