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
commands help
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="antiny2010" data-source="post: 404330" data-attributes="member: 54335"><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p>using System.Data;</p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.Communication.Packets.Outgoing.Users;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Avatar;</p><p>using System.Threading;</p><p>using System.Threading.Tasks;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p>using Plus.HabboHotel.Items;</p><p>using Plus.HabboHotel.Catalog;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Furni;</p><p>using Plus.Database.Interfaces;</p><p>using Plus.Communication.Packets.Outgoing.Notifications;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Engine;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator</p><p>{</p><p> class ViewPrivateMessageCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_view_pms"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return "%username%"; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Lets you view recent PMs from and to a user."; }</p><p> }</p><p></p><p> public void Exec(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("Please enter the username of the user you wish to view private messages of.");</p><p> return;</p><p> }</p><p></p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</p><p> if (TargetClient == null)</p><p> {</p><p> Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");</p><p> return;</p><p> }</p><p></p><p> if (TargetClient.GetHabbo() == null)</p><p> {</p><p> Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online.");</p><p> return;</p><p> }</p><p> StringBuilder b = new StringBuilder();</p><p> b.Append("Private messages - " + TargetClient.GetHabbo().Username + "\n\n");</p><p></p><p> using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> db.SetQuery("SELECT * FROM `chatlogs_console` WHERE `from_id` = @id OR `to_id` = @id ORDER BY id DESC LIMIT 100");</p><p> db.AddParameter("id", TargetClient.GetHabbo().Id);</p><p> db.RunQuery();</p><p> DataTable t = db.GetTable();</p><p></p><p> foreach (DataRow r in t.Rows)</p><p> {</p><p> b.Append(UnixTimeStampToDateTime((double)PlusEnvironment.GetUnixTimestamp()) + "\n");</p><p> b.Append(getUsernameFromId(Convert.ToInt32(r["from_id"])) + " to " + getUsernameFromId(Convert.ToInt32(r["to_id"])) + ": " + Convert.ToString(r["message"]) + "\n\n");</p><p> }</p><p> }</p><p></p><p> Session.SendMessage(new MOTDNotificationComposer(b.ToString()));</p><p> }</p><p></p><p> private DateTime UnixTimeStampToDateTime(double unixTimeStamp)</p><p> {</p><p> // Unix timestamp is seconds past epoch</p><p> System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);</p><p> dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime();</p><p> return dtDateTime;</p><p> }</p><p></p><p> private string getUsernameFromId(int userId)</p><p> {</p><p> if (PlusEnvironment.GetHabboById(userId) != null)</p><p> return PlusEnvironment.GetHabboById(userId).Username;</p><p></p><p> using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> db.SetQuery("SELECT `username` FROM `users` WHERE `id` = @id");</p><p> db.AddParameter("id", userId);</p><p> db.RunQuery();</p><p> return db.GetString();</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p>[doublepost=1490012076,1490011784][/doublepost]thats for view pms command</p></blockquote><p></p>
[QUOTE="antiny2010, post: 404330, member: 54335"] [CODE]using System; using System.Linq; using System.Text; using System.Collections.Generic; using System.Data; using Plus.HabboHotel.GameClients; using Plus.HabboHotel.Rooms; using Plus.Communication.Packets.Outgoing.Users; using Plus.Communication.Packets.Outgoing.Rooms.Avatar; using System.Threading; using System.Threading.Tasks; using Plus.Communication.Packets.Outgoing.Rooms.Chat; using Plus.HabboHotel.Items; using Plus.HabboHotel.Catalog; using Plus.Communication.Packets.Outgoing.Inventory.Furni; using Plus.Database.Interfaces; using Plus.Communication.Packets.Outgoing.Notifications; using Plus.Communication.Packets.Outgoing.Rooms.Engine; namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator { class ViewPrivateMessageCommand : IChatCommand { public string PermissionRequired { get { return "command_view_pms"; } } public string Parameters { get { return "%username%"; } } public string Description { get { return "Lets you view recent PMs from and to a user."; } } public void Exec(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you wish to view private messages of."); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } if (TargetClient.GetHabbo() == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } StringBuilder b = new StringBuilder(); b.Append("Private messages - " + TargetClient.GetHabbo().Username + "\n\n"); using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { db.SetQuery("SELECT * FROM `chatlogs_console` WHERE `from_id` = @id OR `to_id` = @id ORDER BY id DESC LIMIT 100"); db.AddParameter("id", TargetClient.GetHabbo().Id); db.RunQuery(); DataTable t = db.GetTable(); foreach (DataRow r in t.Rows) { b.Append(UnixTimeStampToDateTime((double)PlusEnvironment.GetUnixTimestamp()) + "\n"); b.Append(getUsernameFromId(Convert.ToInt32(r["from_id"])) + " to " + getUsernameFromId(Convert.ToInt32(r["to_id"])) + ": " + Convert.ToString(r["message"]) + "\n\n"); } } Session.SendMessage(new MOTDNotificationComposer(b.ToString())); } private DateTime UnixTimeStampToDateTime(double unixTimeStamp) { // Unix timestamp is seconds past epoch System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToLocalTime(); return dtDateTime; } private string getUsernameFromId(int userId) { if (PlusEnvironment.GetHabboById(userId) != null) return PlusEnvironment.GetHabboById(userId).Username; using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { db.SetQuery("SELECT `username` FROM `users` WHERE `id` = @id"); db.AddParameter("id", userId); db.RunQuery(); return db.GetString(); } } } } [/CODE] [doublepost=1490012076,1490011784][/doublepost]thats for view pms command [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
commands help
Top