character name

05/18/2010 02:32 PrettyGodness#1
Guys, i'm having a problem with the name of chars, i cant whisper or use /ctele, /find, /recall... so i saw at name of characters all of them has 2spaces after the names like player(space)(space), i tried to use that commands with 2 spaces but didnt work i looked at script i found this but seems like ok:

namespace NewestCOServer.PacketHandling
{
class CharacterMaking
{
public static void Handle(Main.GameClient GC, byte[] Data)
{
string CharName ="";
for (int i = 0; i < 16; i++)
if (Data[20 + i] != 0)
CharName += Convert.ToChar(Data[20 + i]);

ushort Body = BitConverter.ToUInt16(Data, 52);
byte Job = Data[54];
if (GC.ValidName(CharName))
{
GC.AddSend(Packets.PopUpMessage(GC.MessageID, Database.CreateCharacter(GC.AuthInfo.Account, CharName, Body, Job)));
}
else
GC.AddSend(Packets.PopUpMessage(GC.MessageID, "Invalid character name!"));
}
}
}

Anyone know anything about that?
05/18/2010 02:52 kinshi88#2
How I get mine:
Code:
string Name = Encoding.ASCII.GetString(Data, 20, 16).Trim(new char[] { (char)0x0000 });
The Trim method removes the character from the front and back of the string.

Based on Hybrid's.
05/18/2010 03:37 PrettyGodness#3
sorry i'm so noob but i need to change this:

string CharName ="";

By This:
string Name = Encoding.ASCII.GetString(Data, 20, 16).Trim(new char[] { (char)0x0000 });

???
05/18/2010 05:17 PrettyGodness#4
Didnt work =\
05/18/2010 05:24 kinshi88#5
Code:
        public static void Handle(byte[] Data, ClientEntity Client)
        {
            string Name = Encoding.ASCII.GetString(
                        Data, 20, 16).Trim(new char[] { (char)0x0000 });

            ....
No loops required.
05/18/2010 05:57 PrettyGodness#6
hey i think i found my problem was in the website script when i make chars by /newacc it works good i'll confirm so i tell u