Jump to content
  • 0

Help make this script available in couple of maps.


Question

Posted

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;
}

4 answers to this question

Recommended Posts

Posted

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.

Posted

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.

Posted (edited)

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

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