Trying with another packet (sound)

08/03/2010 11:37 _DreadNought_#1
Okay so I have this packet (in a command)
Code:
string[] Strings = new string[2];

                                            Strings[0] = (Data[1]);
                                            Strings[1] = "1";
                                            StringPacket SoundPacket = new StringPacket(true);
                                            SoundPacket.UID = client.Entity.UID;
                                            SoundPacket.Type = 20;
                                            SoundPacket.TextsCount = 2;
                                            SoundPacket.Texts.Add(Strings[0]);
                                            SoundPacket.Texts.Add(Strings[1]);
                                            client.Send(SoundPacket);
                                            break;
and I use the command
Quote:
@testsound sound\rain.wav
and it makes a slured sound for less then a second every time I do it, but any other sound like firstblood.wav it wont do anything. Help?

##Yes I did read the other sound packet threads but I'm terrible with packets full stop.
08/03/2010 12:07 Korvacs#2
The first string should be:

Code:
sound/rain.mp3
Try that.
08/03/2010 13:42 _DreadNought_#3
Nope I tried changing the / to \ and a few other things but that didn't work either. :(
08/03/2010 13:52 Basser#4
as you see, he used .mp3, instead of .wav >_>
08/03/2010 19:28 _DreadNought_#5
Yeah nothing works. tried both, I did read his comment, Anybody know the prob?
08/03/2010 20:26 Korvacs#6
I can only assume its an issue with your string packet.
08/03/2010 20:47 _DreadNought_#7
String packet -
Code:
 using System;
using System.Collections.Generic;
using System.Text;

namespace Conquer_Online_Server.Network.GamePackets
{
    public class StringPacket : Writer, Interfaces.IPacket
    {
        public const byte GuildName = 3,
        Spouse = 6,
        Effect = 10,
        GuildList = 11,
        Unknown = 13,
        ViewEquipSpouse = 16,
        StartGamble = 17,
        EndGamble = 18,
        Sound = 20,
        GuildEnemies = 21,
        GuildAllies = 22,
        WhisperDetails = 26;

        byte[] Buffer;

        public StringPacket(bool Create)
        {
            if (Create)
            {
                Buffer = new byte[19];
                WriteUInt16(11, 0, Buffer);
                WriteUInt16(1015, 2, Buffer);
                Texts = new List<string>();
            }
        }
        public uint UID
        {
            get { return BitConverter.ToUInt32(Buffer, 4); }
            set { WriteUInt32(value, 4, Buffer); }
        }
        public byte Type
        {
            get { return Buffer[8]; }
            set { Buffer[8] = value; }
        }
        public byte TextsCount
        {
            get { return Buffer[9]; }
            set { Buffer[9] = value; }
        }
        public List<string> Texts;

        public void Send(Client.GameState client)
        {
            client.Send(Buffer);
        }
        public byte[] ToArray()
        {
            ushort entirelength = 19;
            foreach (string list in Texts)
                entirelength += (ushort)list.Length;
            byte[] buffer = new byte[entirelength];
            WriteUInt16((ushort)(entirelength - 8), 0, buffer);
            WriteUInt16(1015, 2, buffer);
            WriteUInt32(UID, 4, buffer);
            buffer[8] = Type;
            Buffer = buffer;
            WriteStringList(Texts, 9, Buffer);
            return Buffer;
        }
        public void Deserialize(byte[] buffer)
        {
            Buffer = buffer;
            Texts = new List<string>(buffer[9]);
            ushort offset = 10;
            byte count = 0;
            while (count != TextsCount)
            {
                ushort textlength = buffer[offset]; offset++;
                string text = Encoding.ASCII.GetString(buffer, offset, textlength); offset += textlength;
                Texts.Add(text);
                count++;
            }            
        }
    }
}
Looks fine to me.