Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text;
- using System.Drawing;
- using System.Collections.Generic;
- using Plus.HabboHotel.Rooms;
- using Plus.HabboHotel.GameClients;
- using Plus.HabboHotel.Rooms.Chat.Styles;
- using Plus.HabboRoleplay.RoleplayUsers;
- using Plus.HabboHotel.Groups;
- using Plus.HabboRoleplay.Misc;
- using Plus.Communication.Packets.Outgoing.Rooms.Chat;
- using Plus.Utilities;
- namespace Plus.HabboHotel.Rooms.Chat.Commands.Users.Jobs.Types.Police
- {
- class StunCommand : IChatCommand
- {
- public string PermissionRequired
- {
- get { return "command_police_stun"; }
- }
- public string Parameters
- {
- get { return "%user%"; }
- }
- public string Description
- {
- get { return "Atordoar/Pulverizar o usuário alvo, a fim de impedi-los em suas trilhas."; }
- }
- public void Execute(GameClient Session, Rooms.Room Room, string[] Params)
- {
- string Type = "";
- #region Conditions
- if (Params.Length == 1)
- {
- Session.SendWhisper("Ops, você esqueceu de digitar um nome de usuário!", 1);
- return;
- }
- if (Params[0].ToLower() == "spray")
- Type = "spray";
- if (Params[0].ToLower() == "stun")
- Type = "stun";
- GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
- if (TargetClient == null)
- {
- Session.SendWhisper("Ocorreu um erro ao tentar localizar esse usuário, talvez ele esteja off-line...", 1);
- return;
- }
- RoomUser RoomUser = Session.GetRoomUser();
- RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Username);
- if (TargetUser == null)
- {
- Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário, talvez ele não esteja on-line ou nesta sala.", 1);
- return;
- }
- if (!GroupManager.HasJobCommand(Session, "stun") && !Session.GetRoleplay().PoliceTrial)
- {
- Session.SendWhisper("Apenas um policial pode usar este comando!", 1);
- return;
- }
- if (!Session.GetRoleplay().IsWorking && !Session.GetRoleplay().PoliceTrial)
- {
- Session.SendWhisper("Você deve estar trabalhando para usar este comando!", 1);
- return;
- }
- if (Session.GetRoleplay().TryGetCooldown("stun"))
- return;
- if (TargetClient.GetRoleplay().IsDead)
- {
- Session.SendWhisper("Você não pode atordoar alguém que está morto!", 1);
- return;
- }
- if (TargetClient.GetRoleplay().IsJailed && !TargetClient.GetRoleplay().Jailbroken)
- {
- Session.SendWhisper("Você não pode atordoar alguém que está na cadeia!", 1);
- return;
- }
- if (TargetClient.GetRoomUser().Frozen)
- {
- Session.SendWhisper("Você não pode atordoar alguém que já está atordoado, deve algemá-lo em vez disso!", 1);
- return;
- }
- if (TargetUser.IsAsleep)
- {
- Session.SendWhisper("Você não pode atordoar ou pulverizar alguém que não está jogando o jogo agora!", 1);
- return;
- }
- if (Session.GetRoleplay().TryGetCooldown("stun"))
- return;
- Point ClientPos = new Point(RoomUser.Coordinate.X, RoomUser.Coordinate.Y);
- #endregion
- #region Execute
- lock (Room.GetRoomUserManager().GetRoomUsers())
- {
- foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
- {
- if (User == null)
- continue;
- if (User.GetClient() == null)
- continue;
- if (User.GetClient().GetHabbo() == null)
- continue;
- if (User.GetClient().GetRoleplay() == null)
- continue;
- if (Session.GetHabbo().Id == User.UserId)
- continue;
- if (User.IsAsleep)
- continue;
- if (!RoleplayManager.WantedList.ContainsKey(User.UserId))
- continue;
- Point TargetClientPos = new Point(User.Coordinate.X, User.Coordinate.Y);
- double Distance = RoleplayManager.GetDistanceBetweenPoints2D(ClientPos, TargetClientPos);
- if (Distance <= 6)
- {
- User.GetClient().GetRoleplay().TimerManager.CreateTimer("stun", 1000, false);
- User.GetClient().SendMessage(new FloodControlComposer(15));
- if (User.GetClient().GetRoleplay().InsideTaxi)
- User.GetClient().GetRoleplay().InsideTaxi = false;
- User.Frozen = true;
- User.CanWalk = false;
- User.ClearMovement(true);
- }
- }
- }
- Session.Shout("*Atira sua arma atordoante no pulso do vagabundo " + TargetClient.GetHabbo().Username + " e faz ele parar.**", 37);
- Session.GetRoleplay().CooldownManager.CreateCooldown("stun", 1000, 60);
- return;
- #endregion
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement