Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Command Cooldown Help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Supermario" data-source="post: 381047" data-attributes="member: 65433"><p>Hey,</p><p></p><p>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?</p><p></p><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p></p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun</p><p>{</p><p> class HugCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_hug"; }</p><p> }</p><p> public string Parameters</p><p> {</p><p> get { return "%username%"; }</p><p> }</p><p> public string Description</p><p> {</p><p> get { return "Hug another user."; }</p><p> }</p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("Please enter the username of the person you want to Hug.");</p><p> return;</p><p> }</p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</p><p> if (TargetClient == null)</p><p> {</p><p> Session.SendWhisper("The user was not found in the room, maybe they're offline.");</p><p> return;</p><p> }</p><p> RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> if (TargetUser == null)</p><p> {</p><p> Session.SendWhisper("An error occured while finding that user, maybe they're offline or not in this room.");</p><p> }</p><p> if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)</p><p> {</p><p> Session.SendWhisper("You cannot Hug yourself!");</p><p> return;</p><p> }</p><p> if (TargetUser.IsAsleep)</p><p> {</p><p> Session.SendWhisper("Oops, you cannot use this command on someone who is currently away from their Computer.");</p><p> return;</p><p> }</p><p> RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> if (ThisUser == null)</p><p> return;</p><p> if (!((Math.Abs(TargetUser.X - ThisUser.X) >= 2) || (Math.Abs(TargetUser.Y - ThisUser.Y) >= 2)))</p><p> {</p><p> TimeSpan Cooldown = DateTime.Now - Plus.HabboHotel.Users.Habbo.HugCoolDown;</p><p> if (Cooldown.Seconds >= 30)</p><p> {</p><p> Room.SendMessage(new ShoutComposer(ThisUser.VirtualId, "| *Hugs " + Params[1] + "* |", 0, ThisUser.LastBubble = 16));</p><p> System.Threading.Thread.Sleep(1000);</p><p> Room.SendMessage(new ShoutComposer(TargetUser.VirtualId, "| *Is hugged and feeling loved* |", 0, ThisUser.LastBubble = 16));</p><p> System.Threading.Thread.Sleep(1000);</p><p> TargetUser.ApplyEffect(168);</p><p> System.Threading.Thread.Sleep(4000);</p><p> ThisUser.ApplyEffect(0);</p><p> ThisUser.UpdateNeeded = true;</p><p> TargetUser.ApplyEffect(0);</p><p> TargetUser.UpdateNeeded = true;</p><p> Plus.HabboHotel.Users.Habbo.HugCoolDown = DateTime.Now;</p><p> }</p><p> else</p><p> {</p><p> int num = checked(30 - Cooldown.Seconds);</p><p> Session.SendWhisper("Cooldown Mode: " + num + " seconds left until you can do that!", 0);</p><p> return;</p><p> }</p><p> } </p><p> else</p><p> {</p><p> Session.SendWhisper("You're too far away! please try getting closer.");</p><p> return;</p><p> }</p><p> }</p><p> }</p><p> }[/CODE]</p><p></p><p>Hug Cool Down code in Habbo.cs:</p><p>[CODE]public static DateTime HugCoolDown;[/CODE]</p><p>[doublepost=1469718888,1469660660][/doublepost]bump</p></blockquote><p></p>
[QUOTE="Supermario, post: 381047, member: 65433"] 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? [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; } } } }[/CODE] Hug Cool Down code in Habbo.cs: [CODE]public static DateTime HugCoolDown;[/CODE] [doublepost=1469718888,1469660660][/doublepost]bump [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Command Cooldown Help
Top