Jump to content
  • 0

Help make this script available in couple of maps.


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hi, I have this script and I want to add more maps on it. Here's the script.

I like to add this maps besides the one already declared, and maybe more in the future. Thank you.

"prtg_cas01","schg_cas01","arug_cas01"

-	script	GuildLimit1	-1,{
	OnPCLoadMapEvent:
		getmapxy .@map$, .@x, .@y, 0;
		if ( .@map$ == "aldeg_cas01" ) {
			query_sql "SELECT `connect_member` FROM `guild` WHERE `guild_id` = '" +getcharid(2)+ "'",.@c;
			if ( .@c > 10 ) {
				message strcharinfo(0),"Your guild members are over the limit";
				sleep2 2000;
				warp "prontera",156,183;
			}
		}
		end;
}
Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   597
  • Joined:  11/25/11
  • Last Seen:  

Well, you can just change the If, if there will will be only a few maps to:

if ( .@map$ == "aldeg_cas01" || .@map$ == "prtg_cas01" || .@map$ == "arug_cas01" || .@map$ == "schg_cas01") {

Since || means 'or'.

 

Or else, you can set an array and verify it with a for, something like:

	setarray .@maps$[0],"aldeg_cas01","prtg_cas01","arug_cas01","schg_cas01";
	
	getmapxy .@map$, .@x, .@y, 0;
	
	for(set .@i,0; .@i < .@count; set .@i,.@i+1){
		if (.@map$ == .@maps$[.@i]){
			query_sql "SELECT `connect_member` FROM `guild` WHERE `guild_id` = '" +getcharid(2)+ "'",.@c;
			if ( .@c > 10 ) {
				message strcharinfo(0),"Your guild members are over the limit";
				sleep2 2000;
				warp "prontera",156,183;
			}
			end;
		}
	}	
	end;

Also, remember that only maps with loadevent mapflag will trigger the OnPCLoadMapEvent label.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Thanks Haziel, will test this now.

Yes i have the mapflag for the loadevents on a different script, I tend to put all my mapflags on a seperate one so It's all in one place.


Oh BTW, i think i should change the .@c into .@count as what you made.

Link to comment
Share on other sites


  • Group:  Content Moderator
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  639
  • Reputation:   597
  • Joined:  11/25/11
  • Last Seen:  

Sorry, that's my fault, that .@count must be replaced by: 

for(set .@i,0; .@i < getarraysize(.@maps$); set .@i,.@i+1){

It's not related to your .@c.

Edited by Haziel
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Oh okay! Haha thanks, I'll get back to you soon as I've tested it.

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