Plus Emulator Hug Command *ALMOST WORKING*

MadMonsterMan

Member
Mar 25, 2016
202
13
Okay so when I type in :hug %username%
Plus Emulator Habboon Edit
This comes up:
ALmost.png

@Sledmore @JayCustom @Altercationz
 

MadMonsterMan

Member
Mar 25, 2016
202
13
Can you provide the code? I'm assuming you're parsing out the RoomUser rather than GetUsername().
Code:
using System;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
    class Hug : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_hug"; }
        }
        public string Parameters
        {
            get { return "%username%"; }
        }
        public string Description
        {
            get { return "Hug another user"; }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("You must enter a username!");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room.");
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
            {
                Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room.");
                return;
            }
            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);
            if (User2 == null)
                return;

            if (!((Math.Abs(User.X - User2.X) >= 2 && (Math.Abs(User.Y - User2.Y) >= 2))))
            {

                Room.SendMessage(new ChatComposer(User.VirtualId, "Hugs " + User2 + "*", 0, User.LastBubble));
                User.ApplyEffect(9);
            }
            else
            {
                Session.SendWhisper("That user is too far away, try getting closer.");
                return;
            }
        }
    }
}
 
May 1, 2015
470
154
I coded the above command while half asleep.
Here's the working code.
Code:
Hug Command
using System;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
    class Hug : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_hug"; }
        }
        public string Parameters
        {
            get { return "%username%"; }
        }
        public string Description
        {
            get { return "Hug another user"; }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("You must enter a username!");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room.");
                    return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
            if (User == null)
            {
                Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room.");
                return;
            }
            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (ThisUser == null)
                return;

            if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2))))
            {

                Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Hugs " + TargetClient.GetHabbo().Username + "*", 0, User.LastBubble));
                User.ApplyEffect(9);
            }
            else
            {
                Session.SendWhisper("That user is too far away, try getting closer.");
                return;
            }
        }
    }
}
 

Users who are viewing this thread

Top