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 Releases
Server Releases
[RELEASE][PlusEMU] Smokeweed command
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="NeedForSpreed" data-source="post: 397597" data-attributes="member: 46973"><p>Requirements: Visual Studio.</p><p></p><p>Hello you all! I'm writing this tutorial because I saw that on another forum alot of people wanted to use a smokeweed commands that someone posted. Though it wasn't properly done, because it used thread.sleep to create a timer, which isn't the right way. You can read more about it on [USER=72056]@Sage[/USER] , thread (<a href="https://devbest.com/threads/creating-emulator-commands-with-delays.81492/" target="_blank">https://devbest.com/threads/creating-emulator-commands-with-delays.81492/</a>), where he explains both Thread.Sleep and how I do it, Task.Delay. Let's get right into it shall we?</p><p></p><p>To start with open up "Plus Emulator.sln" located in the root of the emulator. Aka when you firstly open up the folder.</p><p></p><p>First off you want to head over to CommandManager.cs located in, HabboHotel/Rooms/Chat/Commands/CommandManager.cs,</p><p>Look for this:</p><p>[CODE]</p><p> private void RegisterUser()</p><p> {</p><p>[/CODE]</p><p>Under that add this:</p><p>[CODE]this.Register("smokeweed", new SmokeWeedCommand());[/CODE]</p><p>[ATTACH=full]5853[/ATTACH]</p><p></p><p>Now you're done with this part. Head over to HabboHotel/Rooms/Chat/Commands/User and create a new .cs file. If you're using Visual Studio right click on the folder and hover Add then create a new Class. Name it "SmokeWeedCommand.cs".</p><p>[ATTACH=full]5854[/ATTACH]</p><p>Just replace everything with this:</p><p></p><p>[CODE]using System;</p><p>using System.Collections.Generic;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Threading.Tasks;</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 SmokeWeedCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_smokeweed"; }</p><p></p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return ""; }</p><p></p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Get as stoned as Snoop Dog"; }</p><p> }</p><p></p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> if (ThisUser == null)</p><p> return;</p><p></p><p> Task.Run(async delegate</p><p> {</p><p> Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", rolls a spliff*", 0, ThisUser.LastBubble));</p><p> await Task.Delay(1000);</p><p> Session.GetHabbo().Effects().ApplyEffect(26);</p><p> Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", Lights up the joint*", 0, ThisUser.LastBubble));</p><p> await Task.Delay(500);</p><p> Session.GetHabbo().Effects().ApplyEffect(0);</p><p> await Task.Delay(1000);</p><p> Session.GetHabbo().Effects().ApplyEffect(53);</p><p> Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", Smokes the beautiful joint*", 0, ThisUser.LastBubble));</p><p> await Task.Delay(5000);</p><p> Session.GetHabbo().Effects().ApplyEffect(0);</p><p> });</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p>Now all that's left is to headover to the database and choose permission_commands. There you make a new field and name it "command_smokeweed". You set group_id to 0 and subscription_id to 0.</p><p>[ATTACH=full]5852[/ATTACH]</p><p>If you did all of that then you shouldn't have any problems and the command should work just fine.</p><p></p><p>Thanks to [USER=72056]@Sage[/USER] , once again for explaining Tasks and Threads <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="NeedForSpreed, post: 397597, member: 46973"] Requirements: Visual Studio. Hello you all! I'm writing this tutorial because I saw that on another forum alot of people wanted to use a smokeweed commands that someone posted. Though it wasn't properly done, because it used thread.sleep to create a timer, which isn't the right way. You can read more about it on [USER=72056]@Sage[/USER] , thread ([URL]https://devbest.com/threads/creating-emulator-commands-with-delays.81492/[/URL]), where he explains both Thread.Sleep and how I do it, Task.Delay. Let's get right into it shall we? To start with open up "Plus Emulator.sln" located in the root of the emulator. Aka when you firstly open up the folder. First off you want to head over to CommandManager.cs located in, HabboHotel/Rooms/Chat/Commands/CommandManager.cs, Look for this: [CODE] private void RegisterUser() { [/CODE] Under that add this: [CODE]this.Register("smokeweed", new SmokeWeedCommand());[/CODE] [ATTACH=full]5853[/ATTACH] Now you're done with this part. Head over to HabboHotel/Rooms/Chat/Commands/User and create a new .cs file. If you're using Visual Studio right click on the folder and hover Add then create a new Class. Name it "SmokeWeedCommand.cs". [ATTACH=full]5854[/ATTACH] Just replace everything with this: [CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Plus.HabboHotel.GameClients; using Plus.Communication.Packets.Outgoing.Rooms.Chat; namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun { class SmokeWeedCommand : IChatCommand { public string PermissionRequired { get { return "command_smokeweed"; } } public string Parameters { get { return ""; } } public string Description { get { return "Get as stoned as Snoop Dog"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (ThisUser == null) return; Task.Run(async delegate { Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", rolls a spliff*", 0, ThisUser.LastBubble)); await Task.Delay(1000); Session.GetHabbo().Effects().ApplyEffect(26); Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", Lights up the joint*", 0, ThisUser.LastBubble)); await Task.Delay(500); Session.GetHabbo().Effects().ApplyEffect(0); await Task.Delay(1000); Session.GetHabbo().Effects().ApplyEffect(53); Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", Smokes the beautiful joint*", 0, ThisUser.LastBubble)); await Task.Delay(5000); Session.GetHabbo().Effects().ApplyEffect(0); }); } } } [/CODE] Now all that's left is to headover to the database and choose permission_commands. There you make a new field and name it "command_smokeweed". You set group_id to 0 and subscription_id to 0. [ATTACH=full]5852[/ATTACH] If you did all of that then you shouldn't have any problems and the command should work just fine. Thanks to [USER=72056]@Sage[/USER] , once again for explaining Tasks and Threads :) [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
[RELEASE][PlusEMU] Smokeweed command
Top