Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.70 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Drawing;
  5. using System.Collections.Generic;
  6.  
  7. using Plus.HabboHotel.Rooms;
  8. using Plus.HabboHotel.GameClients;
  9. using Plus.HabboHotel.Rooms.Chat.Styles;
  10. using Plus.HabboRoleplay.RoleplayUsers;
  11. using Plus.HabboHotel.Groups;
  12. using Plus.HabboRoleplay.Misc;
  13. using Plus.Communication.Packets.Outgoing.Rooms.Chat;
  14. using Plus.Utilities;
  15.  
  16. namespace Plus.HabboHotel.Rooms.Chat.Commands.Users.Jobs.Types.Police
  17. {
  18. class StunCommand : IChatCommand
  19. {
  20. public string PermissionRequired
  21. {
  22. get { return "command_police_stun"; }
  23. }
  24.  
  25. public string Parameters
  26. {
  27. get { return "%user%"; }
  28. }
  29.  
  30. public string Description
  31. {
  32. get { return "Atordoar/Pulverizar o usuário alvo, a fim de impedi-los em suas trilhas."; }
  33. }
  34.  
  35. public void Execute(GameClient Session, Rooms.Room Room, string[] Params)
  36. {
  37. string Type = "";
  38.  
  39. #region Conditions
  40. if (Params.Length == 1)
  41. {
  42. Session.SendWhisper("Ops, você esqueceu de digitar um nome de usuário!", 1);
  43. return;
  44. }
  45.  
  46. if (Params[0].ToLower() == "spray")
  47. Type = "spray";
  48.  
  49. if (Params[0].ToLower() == "stun")
  50. Type = "stun";
  51.  
  52. GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
  53. if (TargetClient == null)
  54. {
  55. Session.SendWhisper("Ocorreu um erro ao tentar localizar esse usuário, talvez ele esteja off-line...", 1);
  56. return;
  57. }
  58.  
  59. RoomUser RoomUser = Session.GetRoomUser();
  60. RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);
  61. if (TargetUser == null)
  62. {
  63. Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja on-line ou nesta sala.", 1);
  64. return;
  65. }
  66.  
  67. if (!GroupManager.HasJobCommand(Session, "stun") && !Session.GetRoleplay().PoliceTrial)
  68. {
  69. Session.SendWhisper("Apenas um policial pode usar este comando!", 1);
  70. return;
  71. }
  72.  
  73. if (!Session.GetRoleplay().IsWorking && !Session.GetRoleplay().PoliceTrial)
  74. {
  75. Session.SendWhisper("Você deve estar trabalhando para usar este comando!", 1);
  76. return;
  77. }
  78.  
  79. if (Session.GetRoleplay().TryGetCooldown("stun"))
  80. return;
  81.  
  82. if (TargetClient.GetRoleplay().IsDead)
  83. {
  84. Session.SendWhisper("Você não pode atordoar alguém que está morto!", 1);
  85. return;
  86. }
  87.  
  88. if (TargetClient.GetRoleplay().IsJailed && !TargetClient.GetRoleplay().Jailbroken)
  89. {
  90. Session.SendWhisper("Você não pode atordoar alguém que está na cadeia!", 1);
  91. return;
  92. }
  93.  
  94. if (TargetClient.GetRoomUser().Frozen)
  95. {
  96. Session.SendWhisper("Você não pode atordoar alguém que já está atordoado, deve algemá-lo em vez disso!", 1);
  97. return;
  98. }
  99.  
  100. if (TargetUser.IsAsleep)
  101. {
  102. Session.SendWhisper("Você não pode atordoar ou pulverizar alguém que não está jogando o jogo agora!", 1);
  103. return;
  104. }
  105. if (Session.GetRoleplay().TryGetCooldown("stun"))
  106. return;
  107.  
  108. Point ClientPos = new Point(RoomUser.Coordinate.X, RoomUser.Coordinate.Y);
  109.  
  110. #endregion
  111.  
  112. #region Execute
  113.  
  114. lock (Room.GetRoomUserManager().GetRoomUsers())
  115. {
  116. foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
  117. {
  118. if (User == null)
  119. continue;
  120.  
  121. if (User.GetClient() == null)
  122. continue;
  123.  
  124. if (User.GetClient().GetHabbo() == null)
  125. continue;
  126.  
  127. if (User.GetClient().GetRoleplay() == null)
  128. continue;
  129.  
  130. if (Session.GetHabbo().Id == User.UserId)
  131. continue;
  132.  
  133. if (User.IsAsleep)
  134. continue;
  135.  
  136. if (!RoleplayManager.WantedList.ContainsKey(User.UserId))
  137. continue;
  138.  
  139. Point TargetClientPos = new Point(User.Coordinate.X, User.Coordinate.Y);
  140. double Distance = RoleplayManager.GetDistanceBetweenPoints2D(ClientPos, TargetClientPos);
  141.  
  142. if (Distance <= 6)
  143. {
  144. User.GetClient().GetRoleplay().TimerManager.CreateTimer("stun", 1000, false);
  145. User.GetClient().SendMessage(new FloodControlComposer(15));
  146.  
  147. if (User.GetClient().GetRoleplay().InsideTaxi)
  148. User.GetClient().GetRoleplay().InsideTaxi = false;
  149.  
  150. User.Frozen = true;
  151. User.CanWalk = false;
  152. User.ClearMovement(true);
  153. }
  154. }
  155. }
  156.  
  157. Session.Shout("*Atira sua arma atordoante no pulso do vagabundo " + TargetClient.GetHabbo().Username + " e faz ele parar.**", 37);
  158. Session.GetRoleplay().CooldownManager.CreateCooldown("stun", 1000, 60);
  159. return;
  160.  
  161. #endregion
  162. }
  163. }
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement