Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Plus.HabboHotel.Rooms;
- using Plus.HabboHotel.GameClients;
- using Plus.Communication.Packets.Outgoing.Rooms.Chat;
- using System.Threading;
- namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
- {
- class
- HugCommand : 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 Self = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
- if (User == Self)
- {
- Session.SendWhisper("You can't hug yourself!");
- 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(44);
- ThisUser.ApplyEffect(44);
- }
- else
- {
- Session.SendWhisper("That user is too far away, try getting closer.");
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement