:online Command for Plus EMU R2

Status
Not open for further replies.

Parsov

Member
May 18, 2016
315
206
C#:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Items;
using Plus.Communication.Packets.Outgoing.Inventory.Furni;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Notifications;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator
{
    class ViewOnlineCommand : IChatCommand
    {
        public string PermissionRequired => "user_6";
        public string Parameters => "";
        public string Description => "View Online Users";

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Dictionary<Habbo, UInt32> clients = new Dictionary<Habbo, UInt32>();

            StringBuilder content = new StringBuilder();
            content.Append("- LIST OF USERS ONLINE -\r\n");

            foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
            {
                if (client == null)
                    continue;

                content.Append("¥ " + client.GetHabbo().Username + " » Is In Room: " + ((client.GetHabbo().CurrentRoom == null) ? " Not In Room." : client.GetHabbo().CurrentRoom.RoomData.Name) + "\r\n");
            }

            Session.SendMessage(new MOTDNotificationComposer(content.ToString()));
            return;
        }
    }
}
 

yagalkatrina

New Member
Jan 1, 2019
23
17
C#:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Items;
using Plus.Communication.Packets.Outgoing.Inventory.Furni;
using Plus.Database.Interfaces;
using Plus.HabboHotel.Users;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Notifications;

namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator
{
    class ViewOnlineCommand : IChatCommand
    {
        public string PermissionRequired => "user_6";
        public string Parameters => "";
        public string Description => "View Online Users";

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Dictionary<Habbo, UInt32> clients = new Dictionary<Habbo, UInt32>();

            StringBuilder content = new StringBuilder();
            content.Append("- LIST OF USERS ONLINE -\r\n");

            foreach (var client in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
            {
                if (client == null)
                    continue;

                content.Append("¥ " + client.GetHabbo().Username + " » Is In Room: " + ((client.GetHabbo().CurrentRoom == null) ? " Not In Room." : client.GetHabbo().CurrentRoom.RoomData.Name) + "\r\n");
            }

            Session.SendMessage(new MOTDNotificationComposer(content.ToString()));
            return;
        }
    }
}
Thanks.
Post automatically merged:

I have the problem where in CommandManager.cs where I put in this.Register("online", new OnlineCommand()); the OnlineCommand won't turn light blue like the others
Post automatically merged:

Have I done something wrong or what?
 
Last edited:

Parsov

Member
May 18, 2016
315
206
Thanks.
Post automatically merged:

I have the problem where in CommandManager.cs where I put in this.Register("online", new OnlineCommand()); the OnlineCommand won't turn light blue like the others
Post automatically merged:

Have I done something wrong or what?
Change it to ViewOnlineCommand and make sure you have opened the .csproj file and not the Folder itself.
 

Parsov

Member
May 18, 2016
315
206
C#:
// Add this into the Command Manager.
this.Register("onlineusers", new ViewOnlineCommand());
Then go into your .csproj file and then add this.
C#:
<Compile Include="HabboHotel\Rooms\Chat\Commands\Moderator\ViewOnlineCommand.cs" />
 

yagalkatrina

New Member
Jan 1, 2019
23
17
Error CS1061 'GameClient' does not contain a definition for 'SendMessage' and no accessible extension method 'SendMessage' accepting a first argument of type 'GameClient' could be found (are you missing a using directive or an assembly reference?) Plus Emulator C:\Users\Administrator\Desktop\Build2 (1)\Release 2\Emulator Source\HabboHotel\Rooms\Chat\Commands\Moderator\ViewOnlineCommand.cs

What's the fix for this?
Post automatically merged:

I sorted that error then it came up with
Error CS1503 Argument 1: cannot convert from 'Plus.Communication.Packets.Outgoing.Notifications.MOTDNotificationComposer' to 'string' Plus Emulator C:\Users\Administrator\Desktop\Build2 (1)\Release 2\Emulator Source\HabboHotel\Rooms\Chat\Commands\Moderator\ViewOnlineCommand.cs 37 Active
Post automatically merged:

I fixed them both, thanks.
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top