Plus EMU Welcome Command

HoldUp

dont even
Aug 31, 2017
242
32
I know it's a simple command but I'm just learning lol. I want the command so that you say :Welcome x and it sends out a chat in the room saying welcome blah blah blah. I got as far as this - I didn't really do it myself lol just copied it from something else -
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
class WelcomeCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_welcome"; }
}

public string Parameters
{
get { return "%target%"; }
}

public string Description
{
get { return "Welcome another user to the hotel!"; }
}

If anyone could code it for me? It's all apart of the learning process
 

JayC

Always Learning
Aug 8, 2013
5,505
1,401
You say you are learning... But then you want to us to code it for you. Absolutely not.

You can look at other commands for references. This is a 3 part command

1) Get the targeted user ( can be found in any commands like push, pull, hit, userinfo )
2) Test to make sure it's a valid target user
3) Send chat ( can be found in any commands like push, pull, hit )

You should be able to figure this out yourself. If not you shouldn't own a hotel.
 

HoldUp

dont even
Aug 31, 2017
242
32
I've done it but...
You must be registered for see images attach
it comes from the user that is being welcomed! So on this line -
You must be registered for see images attach
I've tried changing TargetUser to TargetClient - User - ThisUser but they all give me errors. What to do? lol
 

JayC

Always Learning
Aug 8, 2013
5,505
1,401
The first parameter of chatcomposer is the virtual ID of the user who is talking. You'll need to get the room user of the session gameclient and use their virtual ID
 

Joshhh

Member
Apr 13, 2016
325
177
I've done it but...
You must be registered for see images attach
it comes from the user that is being welcomed! So on this line -
You must be registered for see images attach
I've tried changing TargetUser to TargetClient - User - ThisUser but they all give me errors. What to do? lol
If the "SendMessage" is highlighting in red, try changing it to SendPacket and see if it changes anything?
 

Mikee

Active Member
Jul 8, 2017
162
102
This is lame, if u want something interesting that'll force u to think a bit make a everyone welcomes command. I.e I type in :everyone_welcome x {message}. Then every user in the room excluding the new user will automatically welcome the new user without them needing to do :welcome x themselves.

It'll force u to understand the difference between virtualId and userId, forEach loops or for loops (for loops are faster but forEach look nicer), and maybe lists depending on how u do it.
 

HoldUp

dont even
Aug 31, 2017
242
32
This is lame, if u want something interesting that'll force u to think a bit make a everyone welcomes command. I.e I type in :everyone_welcome x {message}. Then every user in the room excluding the new user will automatically welcome the new user without them needing to do :welcome x themselves.

It'll force u to understand the difference between virtualId and userId, forEach loops or for loops (for loops are faster but forEach look nicer), and maybe lists depending on how u do it.
Maybe I can do that soon. I've just started learning and don't know that much.
 

JayC

Always Learning
Aug 8, 2013
5,505
1,401
This is lame, if u want something interesting that'll force u to think a bit make a everyone welcomes command. I.e I type in :everyone_welcome x {message}. Then every user in the room excluding the new user will automatically welcome the new user without them needing to do :welcome x themselves.

It'll force u to understand the difference between virtualId and userId, forEach loops or for loops (for loops are faster but forEach look nicer), and maybe lists depending on how u do it.
You just have to loop through the current room users with the code you already have and change it. RoomUserManager should have a list of all room users already.
 
ALSO - I would double check that the user you are welcoming is actually NEW.
 

JynX

Posting Freak
Feb 6, 2016
710
438
Like Jay said, I'd check to see if the user is new. You can do this a few ways but what most people do is check if their motto, outfit, etc are the same as they should be by default. If they're not what they should be then you know the user has changed them and can assume they are no longer a new user.
 

JayC

Always Learning
Aug 8, 2013
5,505
1,401
Like Jay said, I'd check to see if the user is new. You can do this a few ways but what most people do is check if their motto, outfit, etc are the same as they should be by default. If they're not what they should be then you know the user has changed them and can assume they are no longer a new user.
I would prefer to create a booelan in the userdata that is "firstLogin". user data is generated on the first login to the emu, so you can verify it is their first login.
 

JynX

Posting Freak
Feb 6, 2016
710
438
I would prefer to create a booelan in the userdata that is "firstLogin". user data is generated on the first login to the emu, so you can verify it is their first login.
True, although I doubt he would even be able to figure out how to do that, so I shot for an easier method.
 

Users who are viewing this thread

Top