public void SendMessage(uint target, string message, int opt) { TS2Packet packet = new TS2Packet(); packet.Create(TS2.STANDARD, TS2.MSGPLAYER, this.SessionKey, this.ClientID, this.SequenceNumber); switch (opt) { case 2: /* player */ packet.Raw(packet.combine(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x02 }, BitConverter.GetBytes(target), packet.Pad(message, message.Length + 1))); break; case 1: /* channel */ packet.Raw(packet.combine(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01 }, BitConverter.GetBytes(target), packet.Pad(message, message.Length + 1))); break; case 0: /* server */ packet.Raw(packet.combine(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, packet.Pad(message, message.Length + 1))); break; } net.Send(packet.toByteArray(), Target); }
public void Ban(uint cid, string message) { /* f0be4501577a75005b0000000200000000000000f8bd354f54000000000011596572206120747572642c20647564652e060000000d000000b870b602 */ /* */ TS2Packet packet = new TS2Packet(); packet.Create(TS2.STANDARD, TS2.BANPLAYER, this.SessionKey, this.ClientID, this.SequenceNumber); packet.Raw(packet.combine(BitConverter.GetBytes(cid), new byte[] { 0x00, 0x00, (byte)message.Length }, packet.Pad(message, 29))); net.Send(packet.toByteArray(), Target); }