• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[RELEASE][PlusEMU] Smokeweed command

Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
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. I read on some post by Spotify where he said that tasks should be used instead so I started reading up on it. I came up with this result. If I'm doing it the wrong way, then I'm open to constructive criticism. Don't hate please :)
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:
[/COLOR]
[COLOR=#474B51]        private void RegisterUser()[/COLOR]
[COLOR=#474B51]        {[/COLOR]
[COLOR=#474B51]
Under that add this:
Code:
this.Register("smokeweed", new SmokeWeedCommand());
http://i.imgur.com/HoZ9Bqo.png


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:


Code:
using System;[/COLOR]
[COLOR=#474B51]using System.Collections.Generic;[/COLOR]
[COLOR=#474B51]using System.Linq;[/COLOR]
[COLOR=#474B51]using System.Text;[/COLOR]
[COLOR=#474B51]using System.Threading.Tasks;[/COLOR]
[COLOR=#474B51]using Plus.HabboHotel.GameClients;[/COLOR]
[COLOR=#474B51]using Plus.Communication.Packets.Outgoing.Rooms.Chat;[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun[/COLOR]
[COLOR=#474B51]{[/COLOR]
[COLOR=#474B51]    class SmokeWeedCommand : IChatCommand[/COLOR]
[COLOR=#474B51]    {[/COLOR]
[COLOR=#474B51]        public string PermissionRequired[/COLOR]
[COLOR=#474B51]        {[/COLOR]
[COLOR=#474B51]            get { return "command_smokeweed"; }[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]        }[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]        public string Parameters[/COLOR]
[COLOR=#474B51]        {[/COLOR]
[COLOR=#474B51]            get { return ""; }[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]        }[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]        public string Description[/COLOR]
[COLOR=#474B51]        {[/COLOR]
[COLOR=#474B51]            get { return "Get as stoned as Snoop Dog"; }[/COLOR]
[COLOR=#474B51]        }[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)[/COLOR]
[COLOR=#474B51]        {[/COLOR]
[COLOR=#474B51]            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);[/COLOR]
[COLOR=#474B51]            if (ThisUser == null)[/COLOR]
[COLOR=#474B51]                return;[/COLOR]
[COLOR=#474B51]
[/COLOR]
[COLOR=#474B51]            Task.Run(async delegate[/COLOR]
[COLOR=#474B51]            {[/COLOR]
[COLOR=#474B51]                Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", rolls a spliff*", 0, ThisUser.LastBubble));[/COLOR]
[COLOR=#474B51]                await Task.Delay(1000);[/COLOR]
[COLOR=#474B51]                Session.GetHabbo().Effects().ApplyEffect(26);[/COLOR]
[COLOR=#474B51]                Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", Lights up the joint*", 0, ThisUser.LastBubble));[/COLOR]
[COLOR=#474B51]                await Task.Delay(500);[/COLOR]
[COLOR=#474B51]                Session.GetHabbo().Effects().ApplyEffect(0);[/COLOR]
[COLOR=#474B51]                await Task.Delay(1000);[/COLOR]
[COLOR=#474B51]                Session.GetHabbo().Effects().ApplyEffect(53);[/COLOR]
[COLOR=#474B51]                Room.SendMessage(new ChatComposer(ThisUser.VirtualId, "*" + Session.GetHabbo().Username + ", Smokes the beautiful joint*", 0, ThisUser.LastBubble));[/COLOR]
[COLOR=#474B51]                await Task.Delay(5000);[/COLOR]
[COLOR=#474B51]                Session.GetHabbo().Effects().ApplyEffect(0);[/COLOR]
[COLOR=#474B51]            });[/COLOR]
[COLOR=#474B51]        }[/COLOR]
[COLOR=#474B51]    }[/COLOR]
[COLOR=#474B51]}[/COLOR]
[COLOR=#474B51]
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.
http://i.imgur.com/6KN49Q1.png
If you did all of that then you shouldn't have any problems and the command should work just fine.

 
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
Please read both commands and tell me if it's a re-release or no... he used thread.sleep and i use tasks. Good luck using commands after the thread has slept. So no this isn't a re-release, this is a more proper release :)

Skickat från min FRD-L09 via Tapatalk
 
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
Nobody really knows the answer to your question. You may seek advice from our great overl0rd saamus on how to do this.
He didn't open the .sln ... that's why he couldn't debug, he only opened the .cs files themselves. Solved it for him though :)

Skickat från min FRD-L09 via Tapatalk
 
Newbie Spellweaver
Joined
Jan 15, 2017
Messages
24
Reaction score
4
AHAHAHAH , Is my command , need you write [FIX]SmokeWeed , but don't [RELEASE]
PFF
 

u20

Newbie Spellweaver
Joined
Sep 27, 2016
Messages
26
Reaction score
5
@Roas are you serious? Please, shut up and learn something.

How can you understand c# if you don't know PHP? Or HTML? Or CSS?
 
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
@Roas are you serious? Please, shut up and learn something.

How can you understand c# if you don't know PHP? Or HTML? Or CSS?
Let him feel proud lol :)

Skickat från min FRD-L09 via Tapatalk
 
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
AHAHAHAH , Is my command , need you write [FIX]SmokeWeed , but don't [RELEASE]
PFF
Instead of becoming mad, see this as a lesson, on how to make delays properly :) And it's not like your command, just the name is :)

Skickat från min FRD-L09 via Tapatalk
 
Experienced Elementalist
Joined
Nov 11, 2015
Messages
238
Reaction score
89
Yet another useless command, but at least it's asynchronous!
I believe some can learn from it

EDIT:
Btw for local variables do use lowerCamelCase!
 
Junior Spellweaver
Joined
May 15, 2014
Messages
165
Reaction score
34
Yet another useless command, but at least it's asynchronous!
I believe some can learn from it

EDIT:
Btw for local variables do use lowerCamelCase!
The release of this command wasn't to make a cool command, it was to get people to use asynchronous code when making delays, etc. :)

Skickat från min FRD-L09 via Tapatalk
 
Back
Top