Go into PlusEnvironment.cs and find class GetUsernameById and replace that entire class with this.how do you do that?
public static string GetUsernameById(int UserId)
{
string Name = "Unknown User";
GameClient Client = GetGame().GetClientManager().GetClientByUserID(UserId);
if (Client != null && Client.GetHabbo() != null)
return Client.GetHabbo().Username;
UserCache User = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(UserId);
if (User != null)
return User.Username;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT `username` FROM `users` WHERE id = @id LIMIT 1");
dbClient.AddParameter("id", UserId);
Name = dbClient.getString();
}
if (string.IsNullOrEmpty(Name))
Name = "Unknown User";
return Name;
}
public static Habbo GetHabboByUsername(String UserName)
{
try
{
using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT `id` FROM `users` WHERE `username` = @user LIMIT 1");
dbClient.AddParameter("user", UserName);
int id = dbClient.getInteger();
if (id > 0)
return GetHabboById(Convert.ToInt32(id));
}
return null;
}
catch { return null; }
}
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.HabboHotel.Users;
using Plus.HabboHotel.Groups;
using Plus.Communication.Packets.Outgoing.Users;
using Plus.Database.Interfaces;
namespace Plus.Communication.Packets.Incoming.Users
{
class OpenPlayerProfileEvent : IPacketEvent
{
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
int userID = Packet.PopInt();
Boolean IsMe = Packet.PopBoolean();
Habbo targetData = PlusEnvironment.GetHabboById(userID);
if (targetData == null)
{
Session.SendNotification("An error occured whilst finding that user's profile.");
return;
}
List<Group> Groups = PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id);
int friendCount = 0;
using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)");
dbClient.AddParameter("userid", userID);
friendCount = dbClient.getInteger();
}
Session.SendMessage(new ProfileInformationComposer(targetData, Session, Groups, friendCount));
}
}
}
I don't think you've done it correctly, it should fix it. I can check over TeamViewer.This doesn't work for me... It keeps saying there's an error while finding the user
I think I'm stupid, but is there a important difference between release and debug? Normally I use Debug and things update well with that setting...You have to open it and visual studio and rebuild the solution
I have have copied the codes and pasted them in my emulator (I did have to capitalize getString and getInteger, but I don't think that's the problem). Then clicked Debug (Multiple Platforms) and started the client. TeamViewer would be nice, but there is probably a timedifference... I'm from Holland. If you're from America the difference is about 5 hours, but if you don't have to go to school/work it's great!I don't think you've done it correctly, it should fix it. I can check over TeamViewer.