Petey Pablo 0 Posted September 8, 2016 how to add required level 50 guild here prontera,164,163,3 script Guild Package 4W_SAILOR,{ .@req_online = 2; // how many players need to online to claim. .@req_lv = MAX_LEVEL; // minimum level of .@online players that has to be. if ( !getcharid(2) ) { mes "[ Guild Package ]"; mes "you must have a guild"; close; } if ( getguildmasterid( getcharid(2) ) != getcharid(0) ) { mes "[ Guild Package ]"; mes "you are not a guild master"; close; } getguildmember getcharid(2), 1; getguildmember getcharid(2), 2; for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) .@online++; if ( .@online < .@req_online ) { mes "[ Guild Package ]"; mes "your guild must have "+ .@req_online +" guild members online"; close; } .@origin = getcharid(3); for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) { if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) { attachrid $@guildmemberaid[.@i]; if ( BaseLevel < .@req_lv ) { .@deny_name$[.@c] = strcharinfo(0); .@c++; } } } attachrid .@origin; if ( .@c ) { mes "[ Guild Package ]"; mes "there are "+ .@c +" member does not meet the level requirement"; mes implode( .@deny_name$, "," ); close; } for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) { if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) { attachrid $@guildmemberaid[.@i]; if ( #guild_package_claimed ) { .@deny_name$[.@c] = strcharinfo(0); .@c++; } } } attachrid .@origin; if ( .@c ) { mes "[ Guild Package ]"; mes "there are "+ .@c +" members already claimed this package within their account"; mes implode( .@deny_name$, "," ); close; } if ( query_sql( "select account_id as aaa, ( select last_ip from login where account_id = aaa ) as last_ip from guild_member where guild_id = "+ getcharid(2) +" group by last_ip", .@aid, .@ip$ ) < .@req_online ) { mes "[ Guild Package ]"; mes "same ip detected"; .@nb = query_sql( "select name, account_id as aaa, ( select last_ip from login where account_id = aaa ) as last_ip from guild_member where guild_id = "+ getcharid(2), .@name$, .@aid, .@ip$ ); for ( .@i = 0; .@i < .@nb; .@i++ ) mes "[ Guild Package ]"; mes (.@i +1)+". "+ .@name$[.@i] +" ("+ .@ip$ +")"; next; } mes "[ Guild Package ]"; mes "Congratulations! Your Gpack has been claimed!"; for ( .@i = 0; .@i < $@guildmembercount; .@i++ ) { if ( isloggedin( $@guildmemberaid[.@i], $@guildmembercid[.@i] ) ) { attachrid $@guildmemberaid[.@i]; if ( getguildmasterid( getcharid(2) ) != $@guildmembercid[.@i] ) getitem 14232, 100; // Yggberry Box else getitem 14232, 100; // Yggberry Box getitem 30110, 100; // Box Of Thunder Box getitem 14004, 100; // EDP Box getitem 31051, 20; // Credits getitem 4302, 1; // Tao Gunka getitem 4305, 2; // Turtle getitem 4121, 2; // Phreeoni getitem 4174, 1; // Deviling getitem 4047, 1; // Ghostring getitem 4128, 1; // GTB getitem 4146, 1; // Maya getitem 4352, 1; // Gen Egnihem getitem 7227, 100; // Voting Proof Ticket #guild_package_claimed = 1; } } attachrid .@origin; close; } Quote Share this post Link to post Share on other sites
0 Legend 43 Posted September 8, 2016 Use sql query to determine guild level. Quote Share this post Link to post Share on other sites
0 Petey Pablo 0 Posted September 8, 2016 Use sql query to determine guild level. How? I don't have knowledge about that. Thanks man! Quote Share this post Link to post Share on other sites
0 Legend 43 Posted September 8, 2016 (edited) Correct me if i did wrong Hope this works *tho, I never tried this one in-game* insert this on your script EDIT: i forgot to attach player id on getcharid query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '" + getcharid(2, ""+strcharinfo(0)+"") + "'",.@gldlvl; if (.@gldlvl < 50) { mes "Sorry, your guild level didn't reach it's level requirement."; close; } Edited September 8, 2016 by Legend Quote Share this post Link to post Share on other sites
0 Petey Pablo 0 Posted September 8, 2016 Correct me if i did wrong Hope this works *tho, I never tried this one in-game* insert this on your script EDIT: i forgot to attach player id on getcharid query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '" + getcharid(2, ""+strcharinfo(0)+"") + "'",.@gldlvl; if (.@gldlvl < 50) { mes "Sorry, your guild level didn't reach it's level requirement."; close; } Insert in what line? Thanks man for the help. Quote Share this post Link to post Share on other sites
0 Legend 43 Posted September 8, 2016 Correct me if i did wrong Hope this works *tho, I never tried this one in-game* insert this on your script EDIT: i forgot to attach player id on getcharid query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '" + getcharid(2, ""+strcharinfo(0)+"") + "'",.@gldlvl; if (.@gldlvl < 50) { mes "Sorry, your guild level didn't reach it's level requirement."; close; } Insert in what line? Thanks man for the help. Add it below this: if ( !getcharid(2) ) { mes "[ Guild Package ]"; mes "you must have a guild"; close; } Quote Share this post Link to post Share on other sites
0 Petey Pablo 0 Posted September 8, 2016 (edited) Correct me if i did wrong Hope this works *tho, I never tried this one in-game* insert this on your script EDIT: i forgot to attach player id on getcharid query_sql "SELECT `guild_lv` FROM `guild` WHERE `guild_id` = '" + getcharid(2, ""+strcharinfo(0)+"") + "'",.@gldlvl; if (.@gldlvl < 50) { mes "Sorry, your guild level didn't reach it's level requirement."; close; } Insert in what line? Thanks man for the help. Add it below this: if ( !getcharid(2) ) { mes "[ Guild Package ]";mes "you must have a guild"; close; } Not working Edited September 8, 2016 by Will Su Quote Share this post Link to post Share on other sites
0 Legend 43 Posted September 8, 2016 Afaik, you need to wait 60 seconds after changes have been done with your guild level since you are sending query to sql Quote Share this post Link to post Share on other sites
0 Petey Pablo 0 Posted September 8, 2016 It works. Big thanks for you man I appreciate your effort on this. I can not forget you XD Quote Share this post Link to post Share on other sites
0 Legend 43 Posted September 9, 2016 my pleasure Quote Share this post Link to post Share on other sites
how to add required level 50 guild here
Share this post
Link to post
Share on other sites