[Help]Same char. names

09/29/2008 04:44 BlooD-BoY#1
well i have a problem with the "Char. making" thing, what i mean is...when a person register to my server, and then log in and stuff, make a char. but the char name is already in use, it would still let him make one....it won't show it on the database, and it will fuck both of em, because the guy that worked on his char. for a while will get his char. fucked up, it won't level and it will roll back every time he exit the game, and the other guy won't be able to log in cuz he doesn't have a char. well ok here's the code :

Code:
foreach (string Name in ExternalDatabase.ForbiddenNames)
                        {
                            if (CharName == Name)
                            {
                                ValidName = false;
                                break;
                            }
                        }



                        if (CharName.IndexOfAny(new char[3] { ' ', '[', ']' }) > -1)
                        {
                            ValidName = false;
                        }

                        if (CharName.Length > 10)
                        {
                            ValidName = false;
                        }

                        try
                        {
                            if (ValidName)
                            {
                                bool Success = InternalDatabase.CreateCharacter(CharName, Class, Model, Avatar, this);
                                if (Success)
                                    Console.WriteLine("New character: " + CharName);
                                Online = false;
                                MySocket.Disconnect();
                            }
                            else
                            {
                                Online = false;
                                MySocket.Disconnect();
                            }
                        }
                        catch
                        {
                            return;
                        }
                    }
                    break;
for some reason the
Code:
foreach (string Name in ExternalDatabase.ForbiddenNames)
                        {
                            if (CharName == Name)
                            {
                                ValidName = false;
                                break;
                            }
                        }
code doesnt work. i tried to change it to "Charr, CharName" and other stuff, but it still didn't work. the rest like "CharName.Length" works perfectly, i use StealArchers source which is PowerSource, so if any one could help me it would be great, thx =)
09/29/2008 07:11 _Emme_#2
Quote:
foreach (string Name in ExternalDatabase.ForbiddenNames)

Use your knowledge of english.
That line checks if the name is any of the ForbiddenNames,such as Tanel,LOTF,GM/PM, etc etc. So,you would have to make a new line,that checks all account names,and character names,hard to explain atm,short on time.
Hope it helped.


Emme
09/29/2008 17:58 © Haydz#3
Quote:
Originally Posted by BlooD-BoY View Post
well i have a problem with the "Char. making" thing, what i mean is...when a person register to my server, and then log in and stuff, make a char. but the char name is already in use, it would still let him make one....it won't show it on the database, and it will fuck both of em, because the guy that worked on his char. for a while will get his char. fucked up, it won't level and it will roll back every time he exit the game, and the other guy won't be able to log in cuz he doesn't have a char. well ok here's the code :

Code:
                        if (CharName.Length > 10)
                        {
                            ValidName = false;
                        }
Just abit puzzled here but... isnt the max length of a name 16 not 10?
09/29/2008 22:02 BlooD-BoY#4
Quote:
Originally Posted by © Haydz View Post
Just abit puzzled here but... isnt the max length of a name 16 not 10?
maybe i dunno, but like some times when people make a guild and then i restart server it shows me the following error : System.IndexOutOfRangeException : Index was outside the bounds of the array.
at CO....bla bla bla bla bla XD and it doesnt load the guild, i thought it was umm cuz of the char. names but its not...well but that doesnt concern me, i wanna know how to fix the same char. name first O_O
10/01/2008 03:10 tao4229#5
Quote:
Originally Posted by BlooD-BoY View Post
maybe i dunno, but like some times when people make a guild and then i restart server it shows me the following error : System.IndexOutOfRangeException : Index was outside the bounds of the array.
at CO....bla bla bla bla bla XD and it doesnt load the guild, i thought it was umm cuz of the char. names but its not...well but that doesnt concern me, i wanna know how to fix the same char. name first O_O
It's because there's a '~' in one of the char's names, and the server trys to split it by a '~'... Basically it f*k'z up if char's names have ~.
10/01/2008 14:09 BlooD-BoY#6
Quote:
Originally Posted by tao4229 View Post
It's because there's a '~' in one of the char's names, and the server trys to split it by a '~'... Basically it f*k'z up if char's names have ~.
well then lets make a command for that :

Code:
                        if (CharName.IndexOfAny(new char[3] { ' ', '~', '~' }) > -1)
                        {
                            ValidName = false;
                        }
10/01/2008 21:30 BlooD-BoY#7
sry for double post, but i really need help with this error, its kinda annoying that people make a same name char. and then ppls chars. get fucked up so plx guys any help? O.O
10/01/2008 23:19 LetterX#8
Code:
                        if (CharName.IndexOfAny(new char[4] { ' ', '[', ']', '~' }) > -1)
                        {
                            ValidName = false;
                        }
10/01/2008 23:29 BlooD-BoY#9
Quote:
Originally Posted by LetterX View Post
Code:
                        if (CharName.IndexOfAny(new char[4] { ' ', '[', ']', '~' }) > -1)
                        {
                            ValidName = false;
                        }
wat does that have to do with the same name problem? O.O
10/01/2008 23:30 LetterX#10
Quote:
Originally Posted by BlooD-BoY View Post
wat does that have to do with the same name problem? O.O
Oh wait D: I was sort of helping by fixing the code above my original post to disallow "~" =D