case 3:
mes "[Guild Pack Info]";
// check if any guild members have ALREADY obtained a guild package
if (query_sql("SELECT `name`,guild_name FROM guildpack_members " +
"LEFT JOIN guildpack_guilds ON guildpack_members.guild_id=guildpack_guilds.guild_id " +
"WHERE account_id IN (SELECT account_id FROM guild_member WHERE guild_id="+getcharid(2)+") LIMIT 1", .@name$,.@guild$) > 0) {
mes "^0000FF"+.@name$+"^FF0000 already received a guild pack while in ^0000FF"+.@guild$+"^000000.";
mes "Each account can only receive a guild pack once.";
close;
}
// check if any players have already obtained a guild package (from that MAC address)
if (query_sql("SELECT `name`,guild_name FROM guildpack_members " +
"LEFT JOIN guildpack_guilds ON guildpack_members.guild_id=guildpack_guilds.guild_id " +
"WHERE mac IN (SELECT last_mac FROM guild_member LEFT JOIN login ON guild_member.account_id=login.account_id WHERE guild_id="+getcharid(2)+") LIMIT 1", .@name$,.@guild$) > 0) {
mes "^0000FF"+.@name$+"^FF0000 already received a guild pack while in ^0000FF"+.@guild$+"^000000.";
mes "Each person can only receive a guild pack once per MAC address.";
close;
}
//check if the player have already gotten their guild package
if (query_sql("SELECT `name`,guild_name FROM guildpack_members " +
"LEFT JOIN guildpack_guilds ON guildpack_members.guild_id=guildpack_guilds.guild_id " +
"WHERE status IN (SELECT status FROM guild_member LEFT JOIN login ON guild_member.account_id=login.account_id WHERE guild_id="+getcharid(2)+") LIMIT 1", .@name$,.@guild$) > 0) {
mes "^0000FF"+.@name$+"^FF0000 already received a guild pack while in ^0000FF"+.@guild$+"^000000.";
mes "Each person can only receive a guild pack once.";
close;
//check if the guild is approved
query_sql(SELECT `guild_id` FROM `guildpack_guilds` WHERE `guild_id` = "+.@guild_id+", .@guild_id2;
if (.@guild_id != .@guild_id2) { //error }
mes "[Guild Pack Info]";
mes "I'm sorry but you do not belong here";
close2;
}
//success
mes "Get your Guild Pack?";
if (select("No:Yes, continue") == 1) close;
for (set .@i,0; .@i<.guild_size; set .@i,.@i+1) {
if (.@account_id[.@i] == playerattached()) {
getitem 30001,1; // leader
} else {
getitem 30002,1, .@account_id[.@i]; // each member
}
}