public void KickFromGuild() { //Wrap our function inside a catcher try { //Open a new packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); //Read short value lenght of name below short CharacterNameLen = Reader.Int16(); //Read string charactername string CharacterName = Reader.String(CharacterNameLen); //Close packet reader Reader.Close(); //Get player information PlayerMgr TargetCharacter = Helpers.GetInformation.GetPlayerName(CharacterName); //Send required packets to network foreach (int member in Character.Network.Guild.Members) { //Make sure member s not null if (member != 0) { //Get information for the guildmember PlayerMgr guildmember = Helpers.GetInformation.GetPlayerMainid(member); //Make sure the guildmember isnt null if (guildmember != null) { //Make sure the kicked member does not receive the packet if (guildmember.Character.Information.CharacterID != TargetCharacter.Character.Information.CharacterID) { guildmember.client.Send(Packet.GuildUpdate(TargetCharacter.Character, 7, 0, 0, 0)); } } } } //Send update packet to the kicked player TargetCharacter.client.Send(Packet.GuildUpdate(TargetCharacter.Character, 7, 0, 0, 0)); //Send guild kick message packet to the kicked player PacketWriter Writer = new PacketWriter(); //Add opcode Writer.Create(OperationCode.SERVER_GUILD_KICK); //Add static byte 1 Writer.Byte(1); //Send packet to kicked member TargetCharacter.client.Send(Writer.GetBytes()); //Send guildkick visual packet update to kicked player TargetCharacter.Send(Packet.GuildKick(TargetCharacter.Character.Information.UniqueID)); //Remove the player from database DB.query("DELETE from guild_members where guild_member_id='" + TargetCharacter.Character.Information.CharacterID + "'"); //Update database Character.Network.Guild.TotalMembers -= 1; DB.query("UPDATE guild SET guild_members_t='" + Character.Network.Guild.TotalMembers + "' WHERE guild_name='" + Character.Network.Guild.Name + "'"); TargetCharacter.CleanUp(TargetCharacter); } //Catch bad exception errors catch (Exception ex) { //Write information to the console Console.WriteLine("Guild Kick Error: {0}", ex); //Write information to the debug log } }