[RELEASE][PlusEMU] Smokeweed command

NeedForSpreed

Member
May 18, 2014
326
71
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 @Sage , thread ( ), 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()
        {
Under that add this:
Code:
this.Register("smokeweed", new SmokeWeedCommand());
You must be registered for see images 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".
You must be registered for see images 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);
            });
        }
    }
}
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.
You must be registered for see images attach

If you did all of that then you shouldn't have any problems and the command should work just fine.

Thanks to @Sage , once again for explaining Tasks and Threads :)
 

Antisj

Member
Apr 21, 2014
126
13
Least I could do. Well done for making such a detailed tutorial :)

Skickat från min FRD-L09 via Tapatalk
Tjenare! Följde hela din tutorial med över 10 kommandon och bara 2 av dem fungerar även fast emulatorn startar och rebuildas! Vad kan va fel? Hade du kunnat hjälpa mig?
 

NeedForSpreed

Member
May 18, 2014
326
71
Tjenare! Följde hela din tutorial med över 10 kommandon och bara 2 av dem fungerar även fast emulatorn startar och rebuildas! Vad kan va fel? Hade du kunnat hjälpa mig?
English please, and if you're going todo this in swedish please PM
 

Hobtel

New Member
May 2, 2012
23
9
Why don't you use emulator texts in the database? Just a pain in the ass to edit the command everytime you want the text to change :p
 

Marko97

M97 Project based Plus EMU
Aug 7, 2013
99
45
CommandManager.cs -> ERROR CS0246:

this.Register("smokeweed", new SmokeWeedCommand());

SmokeWeedCommand.cs -> ERROR CS1061 (3 errors):

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);
});
 

JynX

Posting Freak
Feb 6, 2016
710
438
CommandManager.cs -> ERROR CS0246:

this.Register("smokeweed", new SmokeWeedCommand());

SmokeWeedCommand.cs -> ERROR CS1061 (3 errors):

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);
});
Ensure that this is at the top of the file:
Code:
using Plus.HabboHotel.Rooms.Chat.Commands.User.Fun;

Also change SendMessage to SendPacket
 

Users who are viewing this thread

Top