Argutus

New Member
Apr 14, 2016
5
2
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:

C#:
//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));

        }
    }
}

After that go to CommandManager and put this in:

C#:
this.Register("link", new LinkCommand());

After that go to your db and run this query:

Code:
INSERT INTO `permissions_commands` VALUES ('command_link', '1', '1');

That's it.

Here's a screen of the command:


Let me know what i could do better.
 

Joe

Well-Known Member
Jun 10, 2012
4,088
1,915
Would the link open in a new tab? I’ve seen old releases open in the same tab haha.

Decent release anyway.
 

Argutus

New Member
Apr 14, 2016
5
2
Would the link open in a new tab? I’ve seen old releases open in the same tab haha.

Decent release anyway.
Yep it opens it it in a new tab.
Idk if it has been released before i coded this myself.
 

Shxrty

Shorty#1960
Mar 31, 2018
629
163
Doesn't matter i placed mine under :mimic command.

Just look for :mimic and place it under this
You could put it anywhere in your command manager, but if you want a specific spot on plus search for
Code:
this.Register("mimic", new MimicCommand());
 

Users who are viewing this thread

Top