Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
[PlusEMU] Users profile not showing when offline?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Hypothesis" data-source="post: 453992" data-attributes="member: 83881"><p>Go into <strong>PlusEnvironment.cs </strong>and find class <strong>GetUsernameById </strong>and replace that entire class with this.</p><p>[CODE]public static string GetUsernameById(int UserId)</p><p> {</p><p> string Name = "Unknown User";</p><p></p><p> GameClient Client = GetGame().GetClientManager().GetClientByUserID(UserId);</p><p> if (Client != null && Client.GetHabbo() != null)</p><p> return Client.GetHabbo().Username;</p><p></p><p> UserCache User = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(UserId);</p><p> if (User != null)</p><p> return User.Username;</p><p></p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT `username` FROM `users` WHERE id = @id LIMIT 1");</p><p> dbClient.AddParameter("id", UserId);</p><p> Name = dbClient.getString();</p><p> }</p><p></p><p> if (string.IsNullOrEmpty(Name))</p><p> Name = "Unknown User";</p><p></p><p> return Name;</p><p> }[/CODE]</p><p>Next inside PlusEnvironment, you wanna find class <strong>GetHabboByUsername</strong>, you're gonna replace that entire class with this.</p><p>[CODE]public static Habbo GetHabboByUsername(String UserName)</p><p> {</p><p> try</p><p> {</p><p> using (IQueryAdapter dbClient = GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT `id` FROM `users` WHERE `username` = @user LIMIT 1");</p><p> dbClient.AddParameter("user", UserName);</p><p> int id = dbClient.getInteger();</p><p> if (id > 0)</p><p> return GetHabboById(Convert.ToInt32(id));</p><p> }</p><p> return null;</p><p> }</p><p> catch { return null; }</p><p> }[/CODE]</p><p>Lastly, find <strong>OpenPlayerProfileEvent.cs </strong>and replace that entire class with this.</p><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.HabboHotel.Users;</p><p>using Plus.HabboHotel.Groups;</p><p>using Plus.Communication.Packets.Outgoing.Users;</p><p>using Plus.Database.Interfaces;</p><p></p><p></p><p>namespace Plus.Communication.Packets.Incoming.Users</p><p>{</p><p> class OpenPlayerProfileEvent : IPacketEvent</p><p> {</p><p> public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)</p><p> {</p><p> int userID = Packet.PopInt();</p><p> Boolean IsMe = Packet.PopBoolean();</p><p></p><p> Habbo targetData = PlusEnvironment.GetHabboById(userID);</p><p> if (targetData == null)</p><p> {</p><p> Session.SendNotification("An error occured whilst finding that user's profile.");</p><p> return;</p><p> }</p><p> </p><p> List<Group> Groups = PlusEnvironment.GetGame().GetGroupManager().GetGroupsForUser(targetData.Id);</p><p> </p><p> int friendCount = 0;</p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT COUNT(0) FROM `messenger_friendships` WHERE (`user_one_id` = @userid OR `user_two_id` = @userid)");</p><p> dbClient.AddParameter("userid", userID);</p><p> friendCount = dbClient.getInteger();</p><p> }</p><p></p><p> Session.SendMessage(new ProfileInformationComposer(targetData, Session, Groups, friendCount));</p><p> }</p><p> }</p><p>}[/CODE]</p><p>After that, compile and you should be good, if it doesn't work, respond to the thread.</p></blockquote><p></p>
[QUOTE="Hypothesis, post: 453992, member: 83881"] Go into [B]PlusEnvironment.cs [/B]and find class [B]GetUsernameById [/B]and replace that entire class with this. [CODE]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; }[/CODE] Next inside PlusEnvironment, you wanna find class [B]GetHabboByUsername[/B], you're gonna replace that entire class with this. [CODE]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; } }[/CODE] Lastly, find [B]OpenPlayerProfileEvent.cs [/B]and replace that entire class with this. [CODE]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)); } } }[/CODE] After that, compile and you should be good, if it doesn't work, respond to the thread. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[PlusEMU] Users profile not showing when offline?
Top