Plus EMU Input string was not in a correct format.

Wubblr

New Member
Nov 26, 2015
11
1
Plus will work absolutely fine, and then out the blue it says this error happened 4 times now anybody know a fix?

2017-07-18 03:06:31,201 ERROR - Exception >> Exception:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Convert.ToInt32(String value)
at Plus.HabboHotel.Rooms.RoomData.Fill(DataRow Row) in C:\Users\Sledmore\Desktop\PlusEMU\HabboHotel\Rooms\RoomData.cs:line 87
at Plus.HabboHotel.Rooms.RoomManager.FetchRoomData(Int32 RoomId, DataRow dRow) in C:\Users\Sledmore\Desktop\PlusEMU\HabboHotel\Rooms\RoomManager.cs:line 400
at Plus.HabboHotel.Users.UserData.UserDataFactory.GetUserData(String SessionTicket, Byte& errorCode) in C:\Users\Sledmore\Desktop\PlusEMU\HabboHotel\Users\UserData\UserDataFactory.cs:line 158
at Plus.HabboHotel.GameClients.GameClient.TryAuthenticate(String AuthTicket) in C:\Users\Sledmore\Desktop\PlusEMU\HabboHotel\GameClients\GameClient.cs:line 100
 

Central

Imagination is more important than knowledge.
Feb 22, 2015
709
107
R2 has these errors and I suggest you use a different emulator as I've not seen a fix for this but people suggest turning MySQL Strict Mode off but does not make a difference.
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
R2 has these errors and I suggest you use a different emulator as I've not seen a fix for this but people suggest turning MySQL Strict Mode off but does not make a difference.
Yes it does have a fix..

RoomData.cs Line 87:
Code:
 if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
                UsersNow = Convert.ToInt32(Row["users_now"]);
            else
                UsersNow = 0;

Change to this:
Code:
int intUsers;
            if(!string.IsNullOrEmpty(Row["users_now"].ToString()) && Int32.TryParse(Row["users_now"].ToString(), out intUsers))
                UsersNow = intUsers;
            else
                UsersNow = 0;

It could be faulting because the first code is testing to see if the string is Null or Empty, but then it doesn't check to see if its a valid integer when parsing. The 2nd code will do both.

After doing the above you can run these queries as well:
Code:
ALTER TABLE `rooms` CHANGE `allow_pets` `allow_pets` INT(1) NOT NULL DEFAULT '0', CHANGE `allow_pets_eat` `allow_pets_eat` INT(1) NOT NULL DEFAULT '0', CHANGE `room_blocking_disabled` `room_blocking_disabled` INT(1) NOT NULL DEFAULT '0', CHANGE `allow_hidewall` `allow_hidewall` INT(1) NOT NULL DEFAULT '0', CHANGE `mute_settings` `mute_settings` INT(1) NOT NULL DEFAULT '1', CHANGE `ban_settings` `ban_settings` INT(1) NOT NULL DEFAULT '1', CHANGE `kick_settings` `kick_settings` INT(1) NOT NULL DEFAULT '1';
 
Last edited:

Stee

Oh hot damn. This is my jam.
Jun 28, 2011
285
159
Yes it does have a fix..

No this is not the issue.

RoomData.cs Line 87:
Code:
 if (!string.IsNullOrEmpty(Row["users_now"].ToString()))
                UsersNow = Convert.ToInt32(Row["users_now"]);
            else
                UsersNow = 0;

Change to this:
Code:
int intUsers;
            if(!string.IsNullOrEmpty(Row["users_now"].ToString()) && Int32.TryParse(Row["users_now"].ToString(), out intUsers))
                UsersNow = intUsers;
            else
                UsersNow = 0;

It could be faulting because the first code is testing to see if the string is Null or Empty, but then it doesn't check to see if its a valid integer when parsing. The 2nd code will do both.

After doing the above you can run these queries as well:
Code:
ALTER TABLE `rooms` CHANGE `allow_pets` `allow_pets` INT(1) NOT NULL DEFAULT '0', CHANGE `allow_pets_eat` `allow_pets_eat` INT(1) NOT NULL DEFAULT '0', CHANGE `room_blocking_disabled` `room_blocking_disabled` INT(1) NOT NULL DEFAULT '0', CHANGE `allow_hidewall` `allow_hidewall` INT(1) NOT NULL DEFAULT '0', CHANGE `mute_settings` `mute_settings` INT(1) NOT NULL DEFAULT '1', CHANGE `ban_settings` `ban_settings` INT(1) NOT NULL DEFAULT '1', CHANGE `kick_settings` `kick_settings` INT(1) NOT NULL DEFAULT '1';


All I had to do is run that sql and it fixed the problem. Thank you for this.
 

Users who are viewing this thread

Top