Couple Issues

randrab33

Member
Sep 17, 2017
38
1
Hi,
I have couple issues with my emu.
I use PlusEMU.
Here's the first.
Code:
INSERT INTO `user_wardrobe` (`user_id`,`slot_id`,`look`,`gender`) VALUES (@id,@slot,@look,@gender)
MySql.Data.MySqlClient.MySqlException (0x80004005): Data too long for column 'look' at row 1
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at Plus.Database.Adapter.QueryAdapter.RunQuery() in C:\Users\Administrator\Desktop\projectalaska crackable\Database\Adapter\QueryAdapter.cs:line 198

Secondly,
Code:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Plus.HabboHotel.Rooms.Chat.Commands.User.ColorSetCommand.Execute(GameClient Session, Room Room, String[] Params) in C:\Users\Administrator\Desktop\projectalaska crackable\HabboHotel\Rooms\Chat\Commands\User\ColorSetCommand.cs:line 14
   at Plus.HabboHotel.Rooms.Chat.Commands.CommandManager.Parse(GameClient Session, String Message) in C:\Users\Administrator\Desktop\projectalaska crackable\HabboHotel\Rooms\Chat\Commands\CommandManager.cs:line 106
   at Plus.Communication.Packets.Incoming.Rooms.Chat.ChatEvent.Parse(GameClient Session, ClientPacket Packet) in C:\Users\Administrator\Desktop\projectalaska crackable\Communication\Packets\Incoming\Rooms\Chat\ChatEvent.cs:line 73
   at Plus.Communication.Packets.PacketManager.TryExecutePacket(GameClient Session, ClientPacket Packet) in C:\Users\Administrator\Desktop\projectalaska crackable\Communication\Packets\PacketManager.cs:line 155
   at Plus.HabboHotel.GameClients.GameClient.parser_onNewPacket(ClientPacket Message) in C:\Users\Administrator\Desktop\projectalaska crackable\HabboHotel\GameClients\GameClient.cs:line 76

Here's the ColorSetCommand area I believe is causing the error.
Code:
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                try
                {
                    dbClient.SetQuery("SELECT hex FROM colors WHERE color = '" + colorName + "'");
                    ColorSelected = dbClient.GetString();
                    Session.SendWhisper(colorName + " has been set");
                    if (ColorSelected == string.Empty)
                    {
                        Session.SendWhisper("Oops, we do not have that colour! Check ':setcolor list'.");
                        return;
                    }
                }catch(Exception)
                {
                    Session.SendWhisper("Oops, we do not have that colour! Check ':setcolor list'.");
                    return;
                }
                
            }
 
Feb 10, 2016
48
14
Data too long for column 'look' at row 1
The data the column look can handle should be increased. Else there is some corrupt data that takes up more space than declared for the column.

Long time since I was into habbo, please show the whole class code or all relvant code to the error you are asking for.
The error is with an array, you seem to be asking for a position in the array that does not exists, please show us the code for that variable you've declared.
 
Last edited:

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Looks like you have no colors in your array or you're trying to access something not in the array.

Go to design view of your table user_wardrobe and increase the length of the column, as stated above
 

Jeffrey

Devbest Indian Tech Support
FindRetros Moderator
Feb 5, 2013
1,180
412
Regarding the second issue, this is due to the fact that you may not even have the color table in your database. @Platinum has a fixed database and will be releasing it on the main thread.
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
I would suggest recoding this, partially because you could make an array of colors inside the habbo class, or inside the game class, and only read from the database once (and update the list using an :update colors command), very simple to code and would avoid this issue.

I feel like it's not properly testing from the database select
 

Mikee

Active Member
Jul 8, 2017
162
102
Jay is right, shoulda done it this way.
Make a class for NameColours that gets called when a user loads up the client. It calls RetrieveColours.
Then when setcolor is called, run a null check to make sure that RetrieveColours was actually called. So just check its size is greater 0.
If is is, then access the public list ColorsAvailable from NameColours to get that color.

UpdateColorsCommand would pretty much just run this RetrieveColours method again and store it. If you wanted to u could store it inside habbo.cs, but this should be enough to get u going. Don't have enough time to code it fully and proper and i did it on a texteditor, so excuse me for any linting errors.

Code:
public List<int> ColorsAvailable = new List<int>();
NumberOfRows = 0;


public static void RetreiveColours(){
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()){
dbClient.SetQuery("SELECT COUNT(*) from colors");
NumberOfRows = dbClient.GetInteger();

for (x = 1; x <= NumberOfRows; x++){
 dbClient.SetQuery("SELECT hex FROM colors WHERE id = '" + x);
 Colours.Add(dbClient.GetInteger());
}
}

edit: I realized u need the modify the code i have above, the list needs to be a hashmap instead. An array wouldn't work either. A hashmap would be needed to find the key and the value.
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Jay is right, shoulda done it this way.
Make a class for NameColours that gets called when a user loads up the client. It calls RetrieveColours.
Then when setcolor is called, run a null check to make sure that RetrieveColours was actually called. So just check its size is greater 0.
If is is, then access the public list ColorsAvailable from NameColours to get that color.

UpdateColorsCommand would pretty much just run this RetrieveColours method again and store it. If you wanted to u could store it inside habbo.cs, but this should be enough to get u going. Don't have enough time to code it fully and proper and i did it on a texteditor, so excuse me for any linting errors.

Code:
public List<int> ColorsAvailable = new List<int>();
NumberOfRows = 0;


public static void RetreiveColours(){
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()){
dbClient.SetQuery("SELECT COUNT(*) from colors");
NumberOfRows = dbClient.GetInteger();

for (x = 1; x <= NumberOfRows; x++){
 dbClient.SetQuery("SELECT hex FROM colors WHERE id = '" + x);
 Colours.Add(dbClient.GetInteger());
}
}

edit: I realized u need the modify the code i have above, the list needs to be a hashmap instead. An array wouldn't work either. A hashmap would be needed to find the key and the value.
Not when a user connects. Make it when the emulator starts up after Game.cs gets initialized. It's the same for every user - so it should be a global class.
 

Users who are viewing this thread

Top