Advertisement
Guest User

hugcommand coded by chrome.

a guest
Jul 1st, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. using System;
  2. using Plus.HabboHotel.Rooms;
  3. using Plus.HabboHotel.GameClients;
  4. using Plus.Communication.Packets.Outgoing.Rooms.Chat;
  5. using System.Threading;
  6.  
  7. namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
  8. {
  9. class
  10. HugCommand : IChatCommand
  11. {
  12. public string PermissionRequired
  13. {
  14. get { return "command_hug"; }
  15. }
  16. public string Parameters
  17. {
  18. get { return "%username%"; }
  19. }
  20. public string Description
  21. {
  22. get { return "Hug another user"; }
  23. }
  24. public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
  25. {
  26. if (Params.Length == 1)
  27. {
  28. Session.SendWhisper("You must enter a username!");
  29. return;
  30. }
  31.  
  32. GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
  33. if (TargetClient == null)
  34. {
  35. Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room.");
  36. return;
  37. }
  38.  
  39. RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
  40. if (User == null)
  41. {
  42. Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room.");
  43. return;
  44. }
  45. RoomUser Self = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
  46. if (User == Self)
  47. {
  48. Session.SendWhisper("You can't hug yourself!");
  49. return;
  50. }
  51. RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
  52. if (ThisUser == null)
  53. return;
  54.  
  55. if (Math.Abs(User.X - ThisUser.X) < 2 && Math.Abs(User.Y - ThisUser.Y) < 2 )
  56. {
  57. Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Hugs " + TargetClient.GetHabbo().Username + "*", 0, User.LastBubble));
  58. User.ApplyEffect(44);
  59. ThisUser.ApplyEffect(44);
  60. }
  61. else
  62. {
  63. Session.SendWhisper("That user is too far away, try getting closer.");
  64. return;
  65. }
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement