Yami Posted October 23, 2015 Posted October 23, 2015 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; } Quote
Haziel Posted October 23, 2015 Posted October 23, 2015 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. Quote
Yami Posted October 23, 2015 Author Posted October 23, 2015 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. Quote
Haziel Posted October 23, 2015 Posted October 23, 2015 (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 October 23, 2015 by Haziel Quote
Yami Posted October 23, 2015 Author Posted October 23, 2015 Oh okay! Haha thanks, I'll get back to you soon as I've tested it. Quote
Question
Yami
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"
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.