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
[Plus EMU] Adding Commands
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="JayC" data-source="post: 382712" data-attributes="member: 36373"><p>[CODE]this.Register("hug", new hugCommand());[/CODE]</p><p>[CODE]using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.HabboHotel.Rooms;</p><p>using Plus.Communication.Packets.Outgoing.Rooms.Chat;</p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User</p><p>{</p><p> class hugCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_rp_hug"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return "%target%"; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Give a virtual hug, to a friend!"; }</p><p> }</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 a username.");</p><p> return;</p><p> }</p><p></p><p> GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);</p><p> RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> RoomUser CurrentUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> if (TargetUser == null)</p><p> return;</p><p></p><p> if (((Math.Abs(TargetUser.X - CurrentUser.X) >= 2) || (Math.Abs(TargetUser.Y - CurrentUser.Y) >= 2)))</p><p> {</p><p> Session.SendWhisper("Try to get closer to the user");</p><p> return;</p><p> }</p><p></p><p> TargetClient.GetHabbo().Effects().ApplyEffect(9);</p><p> Session.GetHabbo().Effects().ApplyEffect(9);</p><p></p><p> Room.SendMessage(new ChatComposer(CurrentUser.VirtualId, "*Hugs " + TargetUser.GetUsername() + "*", 0, CurrentUser.LastBubble));</p><p> Room.SendMessage(new ChatComposer(TargetUser.VirtualId, "*Hugs " + CurrentUser.GetUsername() + "*", 0, TargetUser.LastBubble));</p><p></p><p> }</p><p> }</p><p>}[/CODE]</p><p></p><p>Just coded this on my localhost for my hotel, It works.</p></blockquote><p></p>
[QUOTE="JayC, post: 382712, member: 36373"] [CODE]this.Register("hug", new hugCommand());[/CODE] [CODE]using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.HabboHotel.GameClients; using Plus.HabboHotel.Rooms; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Rooms.Chat.Commands.User { class hugCommand : IChatCommand { public string PermissionRequired { get { return "command_rp_hug"; } } public string Parameters { get { return "%target%"; } } public string Description { get { return "Give a virtual hug, to a friend!"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter a username."); return; } GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]); RoomUser TargetUser = Room.GetRoomUserManager().GetRoomUserByHabbo(TargetClient.GetHabbo().Id); RoomUser CurrentUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (TargetUser == null) return; if (((Math.Abs(TargetUser.X - CurrentUser.X) >= 2) || (Math.Abs(TargetUser.Y - CurrentUser.Y) >= 2))) { Session.SendWhisper("Try to get closer to the user"); return; } TargetClient.GetHabbo().Effects().ApplyEffect(9); Session.GetHabbo().Effects().ApplyEffect(9); Room.SendMessage(new ChatComposer(CurrentUser.VirtualId, "*Hugs " + TargetUser.GetUsername() + "*", 0, CurrentUser.LastBubble)); Room.SendMessage(new ChatComposer(TargetUser.VirtualId, "*Hugs " + CurrentUser.GetUsername() + "*", 0, TargetUser.LastBubble)); } } }[/CODE] Just coded this on my localhost for my hotel, It works. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
[Plus EMU] Adding Commands
Top