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="Pinkman" data-source="post: 381113" data-attributes="member: 70090"><p>Try this one mate,</p><p></p><p><span style="color: #000000">using System;</span></p><p><span style="color: #000000">using Plus.HabboHotel.Rooms;</span></p><p><span style="color: #000000">using Plus.HabboHotel.GameClients;</span></p><p><span style="color: #000000">using Plus.Communication.Packets.Outgoing.Rooms.Chat;</span></p><p><span style="color: #000000"></span></p><p><span style="color: #000000">namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun</span></p><p><span style="color: #000000">{</span></p><p><span style="color: #000000"> class Hug : IChatCommand</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> public string PermissionRequired</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> get { return "command_hug"; }</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> public string Parameters</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> get { return "%username%"; }</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> public string Description</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> get { return "Hug another user"; }</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> if (Params.Length == 1)</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> Session.SendWhisper("You must enter a username!");</span></p><p><span style="color: #000000"> return;</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"></span></p><p><span style="color: #000000"> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</span></p><p><span style="color: #000000"> if (TargetClient == null)</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room.");</span></p><p><span style="color: #000000"> return;</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"></span></p><p><span style="color: #000000"> RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</span></p><p><span style="color: #000000"> if (User == null)</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room.");</span></p><p><span style="color: #000000"> return;</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</span></p><p><span style="color: #000000"> if (ThisUser == null)</span></p><p><span style="color: #000000"> return;</span></p><p><span style="color: #000000"></span></p><p><span style="color: #000000"> if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2))))</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"></span></p><p><span style="color: #000000"> Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Hugs " + TargetClient.GetHabbo().Username + "*", 0, User.LastBubble));</span></p><p><span style="color: #000000"> User.ApplyEffect(9);</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> else</span></p><p><span style="color: #000000"> {</span></p><p><span style="color: #000000"> Session.SendWhisper("That user is too far away, try getting closer.");</span></p><p><span style="color: #000000"> return;</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000"> }</span></p><p><span style="color: #000000">}</span></p><p></p><p>and </p><p><span style="color: #ff8000">public static DateTime HugCoolDown; (Habbo.cs)</span></p><p>[doublepost=1469721128,1469721071][/doublepost]Here is more neat layed out.</p><p>[CODE]using System;</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 Hug : 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("You must enter a username!");</p><p> return;</p><p> }</p><p></p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</p><p> if (TargetClient == null)</p><p> {</p><p> Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room.");</p><p> return;</p><p> }</p><p></p><p> RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> if (User == null)</p><p> {</p><p> Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room.");</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></p><p> if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2))))</p><p> {</p><p></p><p> Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Hugs " + TargetClient.GetHabbo().Username + "*", 0, User.LastBubble));</p><p> User.ApplyEffect(9);</p><p> }</p><p> else</p><p> {</p><p> Session.SendWhisper("That user is too far away, try getting closer.");</p><p> return;</p><p> }</p><p> }</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="Pinkman, post: 381113, member: 70090"] Try this one mate, [COLOR=#000000]using System; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun { class Hug : 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("You must enter a username!"); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room."); return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (User == null) { Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room."); return; } RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) return; if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2)))) { Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Hugs " + TargetClient.GetHabbo().Username + "*", 0, User.LastBubble)); User.ApplyEffect(9); } else { Session.SendWhisper("That user is too far away, try getting closer."); return; } } } }[/COLOR] and [COLOR=#ff8000]public static DateTime HugCoolDown; (Habbo.cs)[/COLOR] [doublepost=1469721128,1469721071][/doublepost]Here is more neat layed out. [CODE]using System; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun { class Hug : 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("You must enter a username!"); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room."); return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (User == null) { Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room."); return; } RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) return; if (!((Math.Abs(User.X - ThisUser.X) >= 2 && (Math.Abs(User.Y - ThisUser.Y) >= 2)))) { Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*Hugs " + TargetClient.GetHabbo().Username + "*", 0, User.LastBubble)); User.ApplyEffect(9); } else { Session.SendWhisper("That user is too far away, try getting closer."); return; } } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Command Cooldown Help
Top