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:
After that go to CommandManager and put this in:
After that go to your db and run this query:
That's it.
Here's a screen of the command:
Let me know what i could do better.
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:
You must be registered for see links
You must be registered for see links
Let me know what i could do better.