:commands not working (plus emu)

Enriquelol

New Member
Jul 29, 2018
3
0
The :commands dialogue won't pop up.
This pops up then once you hit View commands nothing happens after that
krp265

Code:
namespace Plus.HabboHotel.Rooms.Chat.Commands
{
    using Plus;
    using Plus.Communication.Packets.Outgoing.Rooms.Notifications;
    using Plus.Database.Interfaces;
    using Plus.HabboHotel.GameClients;
    using Plus.HabboHotel.Items.Wired;
    using Plus.HabboHotel.Rooms.Chat.Commands.Administrator;
    using Plus.HabboHotel.Rooms.Chat.Commands.Events;
    using Plus.HabboHotel.Rooms.Chat.Commands.Moderator;
    using Plus.HabboHotel.Rooms.Chat.Commands.Moderator.Fun;
    using Plus.HabboHotel.Rooms.Chat.Commands.User;
    using Plus.HabboHotel.Rooms.Chat.Commands.User.Fun;
    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
    using System.Text;

    public class CommandManager
    {
        private string _prefix = ":";
        private readonly Dictionary<string, IChatCommand> _commands;

        public CommandManager(string Prefix)
        {
            this._prefix = Prefix;
            this._commands = new Dictionary<string, IChatCommand>();
            this.RegisterVIP();
            this.RegisterUser();
            this.RegisterEvents();
            this.RegisterModerator();
            this.RegisterAdministrator();
        }

        public void LogCommand(int UserId, string Data, string MachineId)
        {
            using (IQueryAdapter adapter = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                adapter.SetQuery("INSERT INTO `logs_client_staff` (`user_id`,`data_string`,`machine_id`, `timestamp`) VALUES (@UserId,@Data,@MachineId,@Timestamp)");
                adapter.AddParameter("UserId", UserId);
                adapter.AddParameter("Data", Data);
                adapter.AddParameter("MachineId", MachineId);
                adapter.AddParameter("Timestamp", PlusEnvironment.GetUnixTimestamp());
                adapter.RunQuery();
            }
        }

        public static string MergeParams(string[] Params, int Start)
        {
            StringBuilder builder = new StringBuilder();
            for (int i = Start; i < Params.Length; i++)
            {
                if (i > Start)
                {
                    builder.Append(" ");
                }
                builder.Append(Params[i]);
            }
            return builder.ToString();
        }

        public bool Parse(GameClient Session, string Message)
        {
            if (((Session != null) && (Session.GetHabbo() != null)) && (Session.GetHabbo().CurrentRoom != null))
            {
                if (!Message.StartsWith(this._prefix))
                {
                    return false;
                }
                if (Message == (this._prefix + "commands"))
                {
                    Session.SendPacket(new RoomNotificationComposer("Commands", "Click the button below for a list of our commands.", "", "View Commands!", "event:habbopages/" + Session.GetHabbo().Rank));
                    return true;
                }
                Message = Message.Substring(1);
                char[] separator = new char[] { ' ' };
                string[] @params = Message.Split(separator);
                if (@params.Length == 0)
                {
                    return false;
                }
                IChatCommand command = null;
                if (this._commands.TryGetValue(@params[0].ToLower(), out command))
                {
                    if (Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
                    {
                        this.LogCommand(Session.GetHabbo().Id, Message, Session.GetHabbo().MachineId);
                    }
                    if (!string.IsNullOrEmpty(command.PermissionRequired) && !Session.GetHabbo().GetPermissions().HasCommand(command.PermissionRequired))
                    {
                        return false;
                    }
                    Session.GetHabbo().IChatCommand = command;
                    object[] objArray1 = new object[] { Session.GetHabbo(), this };
                    Session.GetHabbo().CurrentRoom.GetWired().TriggerEvent(WiredBoxType.TriggerUserSaysCommand, objArray1);
                    command.Execute(Session, Session.GetHabbo().CurrentRoom, @params);
                    return true;
                }
            }
            return false;
        }

        public void Register(string CommandText, IChatCommand Command)
        {
            this._commands.Add(CommandText, Command);
        }

        private void RegisterAdministrator()
        {
            this.Register("bubble", new BubbleCommand());
            this.Register("update", new UpdateCommand());
            this.Register("deletegroup", new DeleteGroupCommand());
            this.Register("carry", new CarryCommand());
            this.Register("goto", new GOTOCommand());
            this.Register("modtools", new ModToolsCommand());
            this.Register("resetgotw", new ResetGotwCommand());
            this.Register("viewinventory", new ViewInventoryCommand());
            this.Register("inv", new ViewInventoryCommand());
        }

        private void RegisterEvents()
        {
            this.Register("eha", new EventAlertCommand());
            this.Register("eventalert", new EventAlertCommand());
        }

        private void RegisterModerator()
        {
            this.Register("ban", new BanCommand());
            this.Register("mip", new MIPCommand());
            this.Register("ipban", new IPBanCommand());
            this.Register("viewpm", new ViewPMCommand());
            this.Register("jail", new JailUserCommand());
            this.Register("ui", new UserInfoCommand());
            this.Register("userinfo", new UserInfoCommand());
            this.Register("sa", new StaffAlertCommand());
            this.Register("roomunmute", new RoomUnmuteCommand());
            this.Register("roommute", new RoomMuteCommand());
            this.Register("roombadge", new RoomBadgeCommand());
            this.Register("roomalert", new RoomAlertCommand());
            this.Register("roomkick", new RoomKickCommand());
            this.Register("mute", new MuteCommand());
            this.Register("smute", new MuteCommand());
            this.Register("unmute", new UnmuteCommand());
            this.Register("massbadge", new MassBadgeCommand());
            this.Register("kick", new KickCommand());
            this.Register("skick", new KickCommand());
            this.Register("ha", new HotelAlertCommand());
            this.Register("hotelalert", new HotelAlertCommand());
            this.Register("hal", new HALCommand());
            this.Register("give", new GiveCommand());
            this.Register("givebadge", new GiveBadgeCommand());
            this.Register("dc", new DisconnectCommand());
            this.Register("kill", new DisconnectCommand());
            this.Register("disconnect", new DisconnectCommand());
            this.Register("alert", new AlertCommand());
            this.Register("tradeban", new TradeBanCommand());
            this.Register("teleport", new TeleportCommand());
            this.Register("summon", new SummonCommand());
            this.Register("override", new OverrideCommand());
            this.Register("massenable", new MassEnableCommand());
            this.Register("massdance", new MassDanceCommand());
            this.Register("freeze", new FreezeCommand());
            this.Register("unfreeze", new UnFreezeCommand());
            this.Register("fastwalk", new FastwalkCommand());
            this.Register("superfastwalk", new SuperFastwalkCommand());
            this.Register("coords", new CoordsCommand());
            this.Register("alleyesonme", new AllEyesOnMeCommand());
            this.Register("allaroundme", new AllAroundMeCommand());
            this.Register("forcesit", new ForceSitCommand());
            this.Register("ignorewhispers", new IgnoreWhispersCommand());
            this.Register("forced_effects", new DisableForcedFXCommand());
            this.Register("makesay", new MakeSayCommand());
            this.Register("flaguser", new FlagUserCommand());
            this.Register("quickpoll", new QuickPollCommand());
        }

        private void RegisterUser()
        {
            this.Register("about", new InfoCommand());
            this.Register("pickall", new PickAllCommand());
            this.Register("ejectall", new EjectAllCommand());
            this.Register("lay", new LayCommand());
            this.Register("sit", new SitCommand());
            this.Register("stand", new StandCommand());
            this.Register("mutepets", new MutePetsCommand());
            this.Register("mutebots", new MuteBotsCommand());
            this.Register("mimic", new MimicCommand());
            this.Register("dance", new DanceCommand());
            this.Register("push", new PushCommand());
            this.Register("pull", new PullCommand());
            this.Register("enable", new EnableCommand());
            this.Register("follow", new FollowCommand());
            this.Register("faceless", new FacelessCommand());
            this.Register("moonwalk", new MoonwalkCommand());
            this.Register("unload", new UnloadCommand());
            this.Register("regenmaps", new RegenMaps());
            this.Register("emptyitems", new EmptyItems());
            this.Register("setmax", new SetMaxCommand());
            this.Register("setspeed", new SetSpeedCommand());
            this.Register("disablediagonal", new DisableDiagonalCommand());
            this.Register("flagme", new FlagMeCommand());
            this.Register("stats", new StatsCommand());
            this.Register("kickpets", new KickPetsCommand());
            this.Register("kickbots", new KickBotsCommand());
            this.Register("room", new RoomCommand());
            this.Register("dnd", new DNDCommand());
            this.Register("disablegifts", new DisableGiftsCommand());
            this.Register("convertcredits", new ConvertCreditsCommand());
            this.Register("disablewhispers", new DisableWhispersCommand());
            this.Register("disablemimic", new DisableMimicCommand());
            this.Register("pet", new PetCommand());
            this.Register("rolldice", new RollDiceCommand());
            this.Register("closedice", new CloseDiceCommand());
            this.Register("sh", new BuildHeightCommand());
            this.Register("pay", new PayCommand());
            this.Register("events", new NotificationCommand());
            this.Register("globalmute", new GlobalMuteCommand());
            this.Register("globaltradeban", new GlobalTradeBanCommand());
            this.Register("discord", new DiscordAlert());
            this.Register("sandbox", new SetRoomSandboxCommand());
            this.Register("roombundle", new RoomBundleCommand());
            this.Register("setcolor", new ColorSetCommand());
            this.Register("notify", new AlertHotelCommand());
            this.Register("warp", new WarpCommand());
            this.Register("reload", new ReloadRoomCommand());
            this.Register("poll", new CreatePollCommand());
            this.Register("badgedef", new SetBadgeDefCommand());
            this.Register("sellroom", new SellRoomCommand());
            this.Register("buyroom", new BuyRoomCommand());
            this.Register("hidewired", new HideWiredCommand());
            this.Register("StaffOnline", new StaffOnline());
        }

        private void RegisterVIP()
        {
            this.Register("spull", new SuperPullCommand());
            this.Register("spush", new SuperPushCommand());
            this.Register("superpush", new SuperPushCommand());
        }

        public bool TryGetCommand(string Command, out IChatCommand IChatCommand) =>
            this._commands.TryGetValue(Command, out IChatCommand);
    }
}

Here is the code
 

Queso

echo 'Web Developer';
Nov 29, 2016
233
72
Hi there @Enriquelol, this is an easy fix.
On this line, after habbopages/, where is the link to the file? It should link to your commands file.
Code:
Session.SendPacket(new RoomNotificationComposer("Commands", "Click the button below for a list of our commands.", "", "View Commands!", "event:habbopages/" + Session.GetHabbo().Rank));
Replace that line with this:
Code:
Session.SendPacket(new RoomNotificationComposer("Commands", "Click the button below for a list of our commands.", "", "View Commands!", "event:habbopages/commands.txt" + Session.GetHabbo().Rank));
This should make the button usable, please respond if this does or does not work.
 

Users who are viewing this thread

Top