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 Releases
Server Releases
[RELEASE] Link Command for [PLUSEMU]
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="Argutus" data-source="post: 464905" data-attributes="member: 67645"><p>This Command allows you to send a link in the chat and when a user clicks on it a new tab opens with the url.</p><p></p><p>This is my first release so be nice.</p><p></p><p>Make a new File called LinkCommand.cs in \HabboHotel\Rooms\Chat\Commands\User and put this code in:</p><p></p><p>[CODE=csharp]//By Argutus :)</p><p>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.GameClients;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User</p><p>{</p><p> class LinkCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_link"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return "%Message%"; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Send a link"; }</p><p> }</p><p></p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("Please enter a message you'd like to send to the room.");</p><p> return;</p><p> }</p><p></p><p></p><p></p><p> RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> if (User == null)</p><p> return;</p><p></p><p></p><p></p><p> string Message = CommandManager.MergeParams(Params, 1);</p><p></p><p> if (Message.Contains("http") || Message.Contains("https"))</p><p> {</p><p> Room.SendPacket(new ChatComposer(User.VirtualId, $"<a href ='{Message}' target='_blank'>{Message}</a>", 2, 2));</p><p> return;</p><p> }</p><p></p><p> Room.SendPacket(new ChatComposer(User.VirtualId, $"<a href ='http://{Message}' target='_blank'>{Message}</a>", 2, 2));</p><p></p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p>After that go to CommandManager and put this in:</p><p></p><p>[CODE=csharp]this.Register("link", new LinkCommand());[/CODE]</p><p></p><p>After that go to your db and run this query:</p><p></p><p>[CODE]</p><p>INSERT INTO `permissions_commands` VALUES ('command_link', '1', '1');</p><p>[/CODE]</p><p></p><p>That's it.</p><p></p><p>Here's a screen of the command:</p><p>[URL unfurl="true"]https://gyazo.com/290759f49be64892319850cf7c8fecbf[/URL]</p><p><a href="https://gyazo.com/290759f49be64892319850cf7c8fecbf" target="_blank">https://gyazo.com/290759f49be64892319850cf7c8fecbf</a></p><p></p><p>Let me know what i could do better.</p></blockquote><p></p>
[QUOTE="Argutus, post: 464905, member: 67645"] This Command allows you to send a link in the chat and when a user clicks on it a new tab opens with the url. This is my first release so be nice. Make a new File called LinkCommand.cs in \HabboHotel\Rooms\Chat\Commands\User and put this code in: [CODE=csharp]//By Argutus :) using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Rooms.Chat.Commands.User { class LinkCommand : IChatCommand { public string PermissionRequired { get { return "command_link"; } } public string Parameters { get { return "%Message%"; } } public string Description { get { return "Send a link"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter a message you'd like to send to the room."); return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (User == null) return; string Message = CommandManager.MergeParams(Params, 1); if (Message.Contains("http") || Message.Contains("https")) { Room.SendPacket(new ChatComposer(User.VirtualId, $"<a href ='{Message}' target='_blank'>{Message}</a>", 2, 2)); return; } Room.SendPacket(new ChatComposer(User.VirtualId, $"<a href ='http://{Message}' target='_blank'>{Message}</a>", 2, 2)); } } } [/CODE] After that go to CommandManager and put this in: [CODE=csharp]this.Register("link", new LinkCommand());[/CODE] After that go to your db and run this query: [CODE] INSERT INTO `permissions_commands` VALUES ('command_link', '1', '1'); [/CODE] That's it. Here's a screen of the command: [URL unfurl="true"]https://gyazo.com/290759f49be64892319850cf7c8fecbf[/URL] [URL]https://gyazo.com/290759f49be64892319850cf7c8fecbf[/URL] Let me know what i could do better. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[RELEASE] Link Command for [PLUSEMU]
Top