Supermario
Member
- Jan 5, 2016
- 99
- 0
Hey,
I am having problems with my cool down, basically when somebody uses a command It basically affects the whole Hotel. For a example. I use the Hug command on somebody, the cool down affects everybody, nobody is able to use any command until the cool down is over. I tried doing separate cool downs for each command, but It still affects the whole hotel? Any suggestions?
Hug Cool Down code in Habbo.cs:
bump
I am having problems with my cool down, basically when somebody uses a command It basically affects the whole Hotel. For a example. I use the Hug command on somebody, the cool down affects everybody, nobody is able to use any command until the cool down is over. I tried doing separate cool downs for each command, but It still affects the whole hotel? Any suggestions?
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;
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("Please enter the username of the person you want to Hug.");
return;
}
GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
if (TargetClient == null)
{
Session.SendWhisper("The user was not found in the room, maybe they're offline.");
return;
}
RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);
if (TargetUser == null)
{
Session.SendWhisper("An error occured while finding that user, maybe they're offline or not in this room.");
}
if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)
{
Session.SendWhisper("You cannot Hug yourself!");
return;
}
if (TargetUser.IsAsleep)
{
Session.SendWhisper("Oops, you cannot use this command on someone who is currently away from their Computer.");
return;
}
RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (ThisUser == null)
return;
if (!((Math.Abs(TargetUser.X - ThisUser.X) >= 2) || (Math.Abs(TargetUser.Y - ThisUser.Y) >= 2)))
{
TimeSpan Cooldown = DateTime.Now - Plus.HabboHotel.Users.Habbo.HugCoolDown;
if (Cooldown.Seconds >= 30)
{
Room.SendMessage(new ShoutComposer(ThisUser.VirtualId, "| *Hugs " + Params[1] + "* |", 0, ThisUser.LastBubble = 16));
System.Threading.Thread.Sleep(1000);
Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "| *Is hugged and feeling loved* |", 0, ThisUser.LastBubble = 16));
System.Threading.Thread.Sleep(1000);
TargetUser.ApplyEffect(168);
System.Threading.Thread.Sleep(4000);
ThisUser.ApplyEffect(0);
ThisUser.UpdateNeeded = true;
TargetUser.ApplyEffect(0);
TargetUser.UpdateNeeded = true;
Plus.HabboHotel.Users.Habbo.HugCoolDown = DateTime.Now;
}
else
{
int num = checked(30 - Cooldown.Seconds);
Session.SendWhisper("Cooldown Mode: " + num + " seconds left until you can do that!", 0);
return;
}
}
else
{
Session.SendWhisper("You're too far away! please try getting closer.");
return;
}
}
}
}
Hug Cool Down code in Habbo.cs:
Code:
public static DateTime HugCoolDown;
bump