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 (
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:
Under that add this:
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".
Just replace everything with this:
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.
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
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 (
You must be registered for see links
), 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:
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);
});
}
}
}
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