Jump to content
  • 0

Filter Guild on Certain map


LearningRO

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

somebody can make me script to filter guild in certain map and only guild id set in list array can enter that map another will be warp to savepoint

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

ah ... found a bug

I forgotten the loadevent can be use from another script

if you install another script with loadevent mapflag

will cause this script to warp out other players indiscriminately

1 more time

http://upaste.me/06e6495427daded7f

EDIT: Jesus ... I made mistake too many times, really lost touch with scripting

 

yeah ... atm, not a godlike scripter yet XD

 

btw, did you guys mentioned wrong person ??

I am @AnnieRuru not @Annie Ruru

Edited by AnnieRuru
  • Upvote 1
  • Love 2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

1 hour ago, melv0 said:

somebody can make me script to filter guild in certain map and only guild id set in list array can enter that map another will be warp to savepoint

Not tested

-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		warp "SavePoint",0,0;
	end;

	
OnInit:
	setarray .guild_id, <ID>, <ID>; // enter guild id
	setarray .maps$,"prontera","geffen";
	for ( .@i = 0;	.@i < getarraysize(.maps$); .@i++)
		setmapflag .maps$[.@i],mf_loadevent;
	end;
}

or this:

-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		warp "SavePoint",0,0;
	end;

	
OnInit:
	setarray .guild_id, <ID>, <ID>; // enter guild id
	end;
}

prontera	mapflag	loadevent
geffen	mapflag	loadevent

 

Edited by pajodex
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

13 hours ago, pajodex said:

Not tested


-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		warp "SavePoint",0,0;
	end;

	
OnInit:
	setarray .guild_id, <ID>, <ID>; // enter guild id
	setarray .maps$,"prontera","geffen";
	for ( .@i = 0;	.@i < getarraysize(.maps$); .@i++)
		setmapflag .maps$[.@i],mf_loadevent;
	end;
}

or this:


-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		warp "SavePoint",0,0;
	end;

	
OnInit:
	setarray .guild_id, <ID>, <ID>; // enter guild id
	end;
}

prontera	mapflag	loadevent
geffen	mapflag	loadevent

 

actually I will implement these scripts in the map castle which already have mapflag loadevent, so if I use this script, all the maps that have a loadevent mapflag will be affected.
is there any solution so that only affects the maps I want only

Edited by melv0
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

20 minutes ago, melv0 said:

actually I will implement these scripts in the map castle which already have mapflag loadevent, so if I use this script, all the maps that have a loadevent mapflag will be affected.
is there any solution so that only affects the maps I want only

-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@q = 0;	.@q < getarraysize(.maps$); .@q++)
		if(strcharinfo(3) != .map$[.@q]) end;
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		warp "SavePoint",0,0;
                                             
	end;

	
OnInit:
	setarray .guild_id, <ID>, <ID>; // enter guild id
	setarray .maps$,"prontera","geffen"; // add maps
	end;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

13 minutes ago, pajodex said:

-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@q = 0;	.@q < getarraysize(.maps$); .@q++)
		if(strcharinfo(3) != .map$[.@q]) end;
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		warp "SavePoint",0,0;
                                             
	end;

	
OnInit:
	setarray .guild_id, <ID>, <ID>; // enter guild id
	setarray .maps$,"prontera","geffen"; // add maps
	end;

 

sir not working script didn't read guild id, player still can enter without guild or guild not list in my array :(

-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@q = 0;	.@q < getarraysize(.maps$); .@q++)
		if(strcharinfo(3) != .map$[.@q]) end;
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		mes "mes";
                                             
	end;

	
OnInit:
	setarray .guild_id, 76, 77; // enter guild id
	setarray .maps$,"prtg_cas04","prtg_cas02"; // add maps
	end;	
}

this is what i was try

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  78
  • Topics Per Day:  0.03
  • Content Count:  436
  • Reputation:   167
  • Joined:  12/12/17
  • Last Seen:  

1 hour ago, melv0 said:

sir not working script didn't read guild id, player still can enter without guild or guild not list in my array :(


-	script	checkguild	-1,{
OnPCLoadMapEvent:
	for ( .@q = 0;	.@q < getarraysize(.maps$); .@q++)
		if(strcharinfo(3) != .map$[.@q]) end;
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		mes "mes";
                                             
	end;

	
OnInit:
	setarray .guild_id, 76, 77; // enter guild id
	setarray .maps$,"prtg_cas04","prtg_cas02"; // add maps
	end;	
}

this is what i was try

-	script	checkguild	-1,{
OnPCLoadMapEvent:
  	addrid(0);
	for ( .@q = 0;	.@q < getarraysize(.maps$); .@q++)
		if(strcharinfo(3) != .map$[.@q]) end;
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		mes "mes";
                                             
	end;

	
OnInit:
	setarray .guild_id, 76, 77; // enter guild id
	setarray .maps$,"prtg_cas04","prtg_cas02"; // add maps
	end;	
}

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

19 hours ago, pajodex said:

-	script	checkguild	-1,{
OnPCLoadMapEvent:
  	addrid(0);
	for ( .@q = 0;	.@q < getarraysize(.maps$); .@q++)
		if(strcharinfo(3) != .map$[.@q]) end;
	for ( .@i = 0;	.@i < getarraysize(.guild_id); .@i++)
	if ( getcharid(2) != .guild_id[.@i]) 
		mes "mes";
                                             
	end;

	
OnInit:
	setarray .guild_id, 76, 77; // enter guild id
	setarray .maps$,"prtg_cas04","prtg_cas02"; // add maps
	end;	
}

 

 

still not working sir player still can enter map castle and didn't show message "MES"

 

@Alayne can u help me with this script :D

Link to comment
Share on other sites

  • 0

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

https://pastebin.com/f9aFiDfv

you can try something like this.

Edited by Emistry
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

42 minutes ago, Emistry said:

https://pastebin.com/f9aFiDfv

you can try something like this.

still not working @Emistry i think script didn't read array guild_id

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

@emistry

        .@map$ = strcharinfo(3);
	        for (.@i = 0; .@i < .map_size; .@i++) {
            if (.@map$ == .map$[.@i]) {
                if (getcharid(2) != .guild_id[.@i] && .guild_id[.@i] > 0)
                    warp "SavePoint",0,0;
                end;
            }
        }

just 1 glance and I can tell this is wrong

since you are comparing 2 different kinds of information -> .@map$ == .map$[.@i] and getcharid(2) == .guild_id[.@i]

shouldn't the 2nd one fall into another loop with .@j index?

 

for(.@j = 0; .@j < guild_id_size; .@j++) <<--- something like this ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

5 minutes ago, AnnieRuru said:

@emistry

 


        .@map$ = strcharinfo(3);
	        for (.@i = 0; .@i < .map_size; .@i++) {
            if (.@map$ == .map$[.@i]) {
                if (getcharid(2) != .guild_id[.@i] && .guild_id[.@i] > 0)
                    warp "SavePoint",0,0;
                end;
            }
        }

just 1 glance and I can tell this is wrong

since you are comparing 2 different kinds of information -> .@map$ == .map$[.@i] and getcharid(2) == .guild_id[.@i]

shouldn't the 2nd one fall into another loop with .@j index?

 

for(.@j = 0; .@j < guild_id_size; .@j++) <<--- something like this ?

hi, @Annie Rurui try to change but still can't read guild_id or nothing happern player without guild or player with guild_id "3" still can enter map

-	script	sample	-1,{

	OnInit:
		setarray .guild_id, 1, 2;
		.guild_id_size = getarraysize(.guild_id);
		
		setarray .maps$, "prtg_cas04";
		.map_size = getarraysize(.maps$);
		
		for (.@i = 0; .@i < .map_size; .@i++)
			setmapflag .maps$[.@i], mf_loadevent;
		end;
		
	OnPCLoadMapEvent:
		.@map$ = strcharinfo(3);
		for (.@j = 0; .@j < .map_size; .@j++) {
			if (.@map$ == .map$[.@i]) {
				if (getcharid(2) != .guild_id[.@j] && .guild_id[.@j] > 0)
					Mes "Testing";
				end;
			}
		}
		end;
}

 

Link to comment
Share on other sites

  • 0

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

10 minutes ago, melv0 said:

still not working @Emistry i think script didn't read array guild_id

https://pastebin.com/f9aFiDfv

the variable name was wrong. fixed.

 

@Annie Ruru

well, if it was multiple guild and multiple map, then ya it should be another loop to check for guild

the sample above are just made for 1 map for 1 guild.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

17 minutes ago, Emistry said:

https://pastebin.com/f9aFiDfv

the variable name was wrong. fixed.

 

@Annie Ruru

well, if it was multiple guild and multiple map, then ya it should be another loop to check for guild

the sample above are just made for 1 map for 1 guild.

hi, @Emistry yeah it' work but when i want to try to make multiple guild_Id it only read first array guild_id and player with guild_Id "2" can't enter maps

this is was i try

-	script	sample	-1,{

	OnInit:
		setarray .guild_id, 1, 2;
		.guild_id_size = getarraysize(.guild_id);
		
		setarray .map$, "prtg_cas04";
		.map_size = getarraysize(.map$);
		
		for (.@i = 0; .@i < .map_size; .@i++)
			setmapflag .map$[.@i], mf_loadevent;
		end;
		
	OnPCLoadMapEvent:
		.@map$ = strcharinfo(3);
		for (.@i = 0; .@i < .map_size; .@i++) {
			if (.@map$ == .map$[.@i]) {
				for (.@j = 0; .@j < .guild_id_size; .@j++)
				if (getcharid(2) != .guild_id[.@j] )
					mes "Debug";
				end;
			}
		}
		end;
}

 

Edited by melv0
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

hmm ... nvm ...

let me try this myself then

of course I tested on my test server b4 posting

 

EDIT: stupid forum IPB3 .... IPB1 is far superior than IPB3

http://upaste.me/06e6495427daded7f

Edited by AnnieRuru
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

9 minutes ago, AnnieRuru said:

hmm ... nvm ...

let me try this myself then

of course I tested on my test server b4 posting

 


-	script	sample	-1,{

	OnInit:
		setarray .guild_id, 1,2; // allowed guild ID
		.guild_id_size = getarraysize(.guild_id);
		
		setarray .map$, "prontera","payon"; // restricted map
		.map_size = getarraysize(.map$);
		
		for (.@i = 0; .@i < .map_size; .@i++)
			setmapflag .map$[.@i], mf_loadevent;
		end;
		
	OnPCLoadMapEvent:
//		GMs should bypass this kind of things
//		if ( getgmlevel() >= 99 ) end;

		.@map$ = strcharinfo(3);
		for (.@i = 0; .@i < .map_size; .@i++)
			if (.@map$ == .map$[.@i])
				for ( .@j = 0; .@j < .guild_id_size; .@j++ )
					if (getcharid(2) == .guild_id[.@j])
						end; // if all condition met, the player isn't warp away

		// falls here if the condition failed
		warp "Save",0,0;
		end;
}

 

fully working what i want :D 

thanks a loot @Annie Ruru

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

51 minutes ago, AnnieRuru said:

ah ... found a bug

I forgotten the loadevent can be use from another script

if you install another script with loadevent mapflag

will cause this script to warp out other players indiscriminately

1 more time

http://upaste.me/06e6495427daded7f

EDIT: Jesus ... I made mistake too many times, really lost touch with scripting

 

yeah ... atm, not a godlike scripter yet XD

 

btw, did you guys mentioned wrong person ??

I am @AnnieRuru not @Annie Ruru

ahh thx u @AnnieRuru

and sorry about that i didn't know have 2 annieruru in here :D

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

Sorry @AnnieRuru i try your last script but only read frist array guild_id

-	script	WoE	-1,{

	OnInit:
		setarray .guild_id, 77,78; // allowed guild ID
		.guild_id_size = getarraysize(.guild_id);
		
		setarray .map$, "prtg_cas04","prtg_cas03"; // restricted map
		.map_size = getarraysize(.map$);
		
		for (.@i = 0; .@i < .map_size; .@i++)
			setmapflag .map$[.@i], mf_loadevent;
		end;
		
	OnPCLoadMapEvent:
//		GMs should bypass this kind of things
//		if ( getgmlevel() >= 99 ) end;

		.@map$ = strcharinfo(3);
		for (.@i = 0; .@i < .map_size; .@i++) {
			if (.@map$ == .map$[.@i]) { // is on the map
				for ( .@j = 0; .@j < .guild_id_size; .@j++ ) {
					if (getcharid(2) == .guild_id[.@j]) {
						mes "sukses";
						end; // if the condition met, the player isn't warp away
					}
				mes "You are not allowed";
				end;
				}
			}
		end;
		}
}

this script only read frist array in guild_id

so player with guild_id "78" still can entry the map

Update :

i think this script only read frist array on guild_id and map$ :(

Edited by melv0
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

#$%@#$^#&&^)(*&_#$%@#$!@#$%#!!@#@%$& ............/spit

[Error]: Missing 1 right curlys in file 'npc/zzz.txt', line '183'.

 

1 more time

I modified the paste

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

5 minutes ago, AnnieRuru said:

#$%@#$^#&&^)(*&_#$%@#$!@#$%#!!@#@%$& ............/spit

 


[Error]: Missing 1 right curlys in file 'npc/zzz.txt', line '183'.

 

 

1 more time

I modified the paste

yeah i know about that and fix it by myself but this script still only read frist array :(

sorry last script work perfectly :)

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