PLUS emu mus command goto not working

Results 1 to 5 of 5
  1. #1
    Valued Member Tom Lammers is offline
    MemberRank
    Dec 2012 Join Date
    Westerzicht, ZeLocation
    144Posts

    PLUS emu mus command goto not working

    Hello Ragezone,

    Why is my mus command not working?


    Here is my php code.
    Code:
    $port = 30001;
    $ip = "127.0.0.1";
    	
    	
    $musData = 'goto' . chr(1) . '2006 1585';
    
    $sock =  @socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp'));   
      @socket_connect($sock, $ip, intval($port)); 
      @socket_send($sock, $musData, strlen($musData), MSG_DONTROUTE);	   
      @socket_close($sock);
    Here the error on the emu,


    What's wrong in my code?

    Tom


  2. #2
    Member selimrecep is offline
    MemberRank
    Jun 2014 Join Date
    72Posts

    Re: PLUS emu mus command goto not working

    Try this:
    PHP Code:
    $mus = array(
    'hostname' => 'localhost',
    'port' => 30001
    );
    function 
    sendMUS($command,$parameter1 "",$parameter2 "",$host NULL,$port NULL){    global $debug$mus;    try{        if($host === NULL$host $mus["hostname"];        if($port === NULL$port $mus["port"];       $message $command chr(1) . $parameter1 ":" $parameter2;       $socket socket_create(AF_INETSOCK_STREAM0) or die("error");        $result socket_connect($socket$host$port) or die("error");       socket_write($socket$messagestrlen($message)) or die("error");             socket_close($socket);       return true;    }catch(Exception $e){        return false;    }} 
    Edit:
    Replace
    $musData = 'goto' . chr(1) . '2006 1585';
    to
    $musData = 'goto' . chr(1) . '2006:1585';
    in your code. Must be ':'.

  3. #3
    Valued Member Tom Lammers is offline
    MemberRank
    Dec 2012 Join Date
    Westerzicht, ZeLocation
    144Posts

    Re: PLUS emu mus command goto not working

    Quote Originally Posted by selimrecep View Post
    Try this:
    PHP Code:
    $mus = array(
    'hostname' => 'localhost',
    'port' => 30001
    );
    function 
    sendMUS($command,$parameter1 "",$parameter2 "",$host NULL,$port NULL){    global $debug$mus;    try{        if($host === NULL$host $mus["hostname"];        if($port === NULL$port $mus["port"];       $message $command chr(1) . $parameter1 ":" $parameter2;       $socket socket_create(AF_INETSOCK_STREAM0) or die("error");        $result socket_connect($socket$host$port) or die("error");       socket_write($socket$messagestrlen($message)) or die("error");             socket_close($socket);       return true;    }catch(Exception $e){        return false;    }} 
    Edit:
    Replace
    $musData = 'goto' . chr(1) . '2006 1585';
    to
    $musData = 'goto' . chr(1) . '2006:1585';
    in your code. Must be ':'.
    Is not working same error,
    And i use a clean plusEMU

  4. #4
    Member selimrecep is offline
    MemberRank
    Jun 2014 Join Date
    72Posts

    Re: PLUS emu mus command goto not working

    Can you give MusConnection.cs if not habboon edit?(pastebin)
    Last edited by selimrecep; 26-08-16 at 03:58 PM.

  5. #5
    Valued Member Tom Lammers is offline
    MemberRank
    Dec 2012 Join Date
    Westerzicht, ZeLocation
    144Posts

    Re: PLUS emu mus command goto not working

    Code:
    using System;
    using System.Linq;
    using System.Net;
    using System.Net.Sockets;
    using System.Collections.Generic;
    
    using log4net;
    using Plus.Core;
    using System.Text;
    using Plus.HabboHotel.Rooms;
    using Plus.HabboHotel.GameClients;
    
    using Plus.Communication.Packets.Outgoing.Catalog;
    using Plus.Communication.Packets.Outgoing.Moderation;
    using Plus.Communication.Packets.Outgoing.Inventory.Purse;
    using Plus.Communication.Packets.Outgoing.Inventory.Badges;
    using Plus.Communication.Packets.Outgoing.Rooms.Engine;
    
    using Plus.Database.Interfaces;
    using Plus.Communication.Packets.Outgoing.Rooms.Session;
    using Plus.HabboHotel.Camera;
    
    namespace Plus.Messages.Net
    {
    
        public class MusConnection
        {
            private Socket _socket;
            private byte[] _buffer = new byte[1024];
    
            private static readonly ILog log = LogManager.GetLogger("Plus.Messages.Net.MusConnection");
    
            public MusConnection(Socket Socket)
            {
                this._socket = Socket;
    
                try
                {
                    this._socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, OnEvent_RecieveData, _socket);
                }
                catch { this.tryClose(); }
            }
    
            public void tryClose()
            {
                try
                {
                    this._socket.Shutdown(SocketShutdown.Both);
                    this._socket.Close();
                    this._socket.Dispose();
                }
                catch
                {
                }
    
                this._socket = null;
                this._buffer = null;
            }
    
            public void OnEvent_RecieveData(IAsyncResult iAr)
            {
                try
                {
                    int bytes = 0;
    
                    try
                    {
                        bytes = _socket.EndReceive(iAr);
                    }
                    catch
                    {
                        tryClose();
                        return;
                    }
    
                    String data = Encoding.Default.GetString(_buffer, 0, bytes);
    
                    if (data.Length > 0)
                        processCommand(data);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
    
                tryClose();
            }
    
            public void processCommand(String data)
            {
                GameClient Client = null;
    
                String header = data.Split(Convert.ToChar(1))[0];
                String param = data.Split(Convert.ToChar(1))[1];
    
                string[] Params = param.ToString().Split(':');
    
                switch (header.ToLower())
                {
                    #region User Related
                    #region :reload_credits <UserID>
                    case "reload_credits":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            int Credits = 0;
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `credits` FROM `users` WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("id", UserId);
                                Credits = dbClient.getInteger();
                            }
    
                            Client.GetHabbo().Credits = Credits;
                            Client.SendMessage(new CreditBalanceComposer(Client.GetHabbo().Credits));
                            break;
                        }
    
                    #region Camera related
                    #region :add_preview <photo_id> <user_id> <created_at>
                    case "add_preview":
                        {
                            int PhotoId = Convert.ToInt32(Params[0]);
                            int UserId = Convert.ToInt32(Params[1]);
                            long CreatedAt = Convert.ToInt64(Params[2]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
    
                            if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId < 1)
                                break;
    
                            PlusEnvironment.GetGame().GetCameraManager().AddPreview(new CameraPhotoPreview(PhotoId, UserId, CreatedAt));
                            break;
                        }
                    #endregion
                    #endregion
                    #endregion
                    #region :reload_pixels <UserID>
                    case "reload_pixels":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            int Pixels = 0;
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `activity_points` FROM `users` WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("id", UserId);
                                Pixels = dbClient.getInteger();
                            }
    
                            Client.GetHabbo().Duckets = Pixels;
                            Client.SendMessage(new HabboActivityPointNotificationComposer(Client.GetHabbo().Duckets, Pixels));
                            break;
                        }
                    #endregion
                    #region :reload_diamonds <UserID>
                    case "reload_diamonds":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            int Diamonds = 0;
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `vip_points` FROM `users` WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("id", UserId);
                                Diamonds = dbClient.getInteger();
                            }
    
                            Client.GetHabbo().Diamonds = Diamonds;
                            Client.SendMessage(new HabboActivityPointNotificationComposer(Diamonds, 0, 5));
                            break;
                        }
                    #endregion
                    #region :reload_gotw <UserID>
                    case "reload_gotw":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            int GOTWPoints = 0;
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `gotw_points` FROM `users` WHERE `id` = @id LIMIT 1");
                                dbClient.AddParameter("id", UserId);
                                GOTWPoints = dbClient.getInteger();
                            }
    
                            Client.GetHabbo().GOTWPoints = GOTWPoints;
                            Client.SendMessage(new HabboActivityPointNotificationComposer(GOTWPoints, 0, 103));
                            break;
                        }
                    #endregion
                    #region :reload_user_rank userID
                    case "reload_user_rank":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `rank` FROM `users` WHERE `id` = @userID LIMIT 1");
                                dbClient.AddParameter("userID", UserId);
                                Client.GetHabbo().Rank = dbClient.getInteger();
                            }
                            break;
                        }
                    #endregion
                    #region :reload_user_vip userID
                    case "reload_user_vip":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `rank_vip` FROM `users` WHERE `id` = @userID LIMIT 1");
                                dbClient.AddParameter("userID", UserId);
                                Client.GetHabbo().VIPRank = dbClient.getInteger();
                            }
                            break;
                        }
                    #endregion
                    #region :reload_motto userID
                    case "reload_motto":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `motto` FROM `users` WHERE `id` = @userID LIMIT 1");
                                dbClient.AddParameter("userID", UserId);
                                Client.GetHabbo().Motto = dbClient.getString();
                            }
    
                            if (Client.GetHabbo().InRoom)
                            {
                                Room Room = Client.GetHabbo().CurrentRoom;
                                if (Room == null)
                                    return;
    
                                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Client.GetHabbo().Id);
                                if (User == null || User.GetClient() == null)
                                    return;
    
                                Room.SendMessage(new UserChangeComposer(User, false));
                            }
                            break;
                        }
                    #endregion
                    #region :alert_user <userid> <message>
                    case "alert":
                    case "alert_user":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            string alertMessage = Convert.ToString(Params[1]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            Client.SendMessage(new BroadcastMessageAlertComposer(alertMessage));
                            break;
                        }
                    #endregion
                    #region :reload_badges <UserID>
                    case "update_badges":
                    case "reload_badges":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
    
                            if (Client != null)
                            {
                                if (Client.GetHabbo() != null)
                                {
                                    Client.SendMessage(new BadgesComposer(Client));
                                }
                            }
                            break;
                        }
                    #endregion
                    #region :givebadge <UserID> <badge>
                    case "givebadge":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            string badgeCode = Convert.ToString(Params[1]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
    
                            if (Client != null)
                            {
                                if (Client.GetHabbo() != null)
                                {
                                    Client.GetHabbo().GetBadgeComponent().GiveBadge(badgeCode, true, Client);
                                }
                            }
                            break;
                        }
                    #endregion
                    #region :disconnect <username>
                    case "disconnect":
                        {
                            try
                            {
                                GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Convert.ToInt32(Params[0]));
                                if (TargetClient != null && TargetClient.GetConnection() != null)
                                    TargetClient.GetConnection().Dispose();
                            }
                            catch
                            {
                                log.Error("Error disconnecting user using MUS");
                            }
                            return;
                        }
                    #endregion
                    #region :reload_last_change userID
                    case "reload_last_change":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                            {
                                dbClient.SetQuery("SELECT `last_change` FROM `users` WHERE `id` = @userID LIMIT 1");
                                dbClient.AddParameter("userID", UserId);
                                Client.GetHabbo().LastNameChange = dbClient.getInteger();
                            }
                            break;
                        }
                    #endregion
                    #region :goto <UserID> <RoomID>
                    case "goto":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            int RoomId = Convert.ToInt32(Params[1]);
    
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            if (!int.TryParse(Params[1], out RoomId))
                                break;
                            else
                            {
                                Room _room = PlusEnvironment.GetGame().GetRoomManager().LoadRoom(RoomId);
                                if (_room == null)
                                    Client.SendNotification("Failed to find the requested room!");
                                else
                                {
                                    if (!Client.GetHabbo().InRoom)
                                        Client.SendMessage(new RoomForwardComposer(_room.Id));
                                    else
                                        Client.GetHabbo().PrepareRoom(_room.Id, "");
                                }
                            }
                        }
                        break;
                    #endregion
                    #endregion
    
                    #region Fastfood
                    #region :progress_achievement
                    case "progress_achievement":
                        {
                            int UserId = Convert.ToInt32(Params[0]);
                            Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                            if (Client == null || Client.GetHabbo() == null)
                                break;
    
                            string Achievement = Convert.ToString(Params[1]);
                            int Progress = Convert.ToInt32(Params[2]);
    
                            PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Client, Achievement, Progress);
                            break;
                        }
                    #endregion
                    #endregion
    
                    #region Settings related
                    #region :reload_filter/:update_filter
                    case "update_filter":
                    case "reload_filter":
                    case "recache_filter":
                    case "refresh_filter":
                        {
                            PlusEnvironment.GetGame().GetChatManager().GetFilter().Init();
                            break;
                        }
                    #endregion
                    #region :reload_catalog/:reload_catalog
                    case "update_catalog":
                    case "reload_catalog":
                    case "recache_catalog":
                    case "refresh_catalog":
                    case "update_catalogue":
                    case "reload_catalogue":
                    case "recache_catalogue":
                    case "refresh_catalogue":
                        {
                            PlusEnvironment.GetGame().GetCatalog().Init(PlusEnvironment.GetGame().GetItemManager());
                            PlusEnvironment.GetGame().GetClientManager().SendMessage(new CatalogUpdatedComposer());
                            break;
                        }
                    #endregion
                    #region :reload_items/:update_items
                    case "update_items":
                    case "reload_items":
                    case "recache_items":
                    case "refresh_items":
                        {
                            PlusEnvironment.GetGame().GetItemManager().Init();
                            break;
                        }
                    #endregion
                    #region :reload_navigator/:update_navigator
                    case "update_navigator":
                    case "reload_navigator":
                    case "recache_navigator":
                    case "refresh_navigator":
                        {
                            PlusEnvironment.GetGame().GetNavigator().Init();
                            break;
                        }
                    #endregion
                    #region :reload_ranks/:update_ranks
                    case "update_ranks":
                    case "reload_ranks":
                    case "recache_ranks":
                    case "refresh_ranks":
                        {
                            PlusEnvironment.GetGame().GetPermissionManager().Init();
    
                            foreach (GameClient C in PlusEnvironment.GetGame().GetClientManager().GetClients.ToList())
                            {
                                if (C == null || C.GetHabbo() == null || C.GetHabbo().GetPermissions() == null)
                                    continue;
    
                                C.GetHabbo().GetPermissions().Init(Client.GetHabbo());
                            }
                            break;
                        }
                    #endregion
                    #region :reload_settings/:update_settings
                    case "update_settings":
                    case "reload_settings":
                    case "recache_settings":
                    case "refresh_settings":
                        {
                            PlusEnvironment.ConfigData = new ConfigData();
                            break;
                        }
                    #endregion
                    #region :reload_quests/:update_quests
                    case "reload_quests":
                    case "update_quests":
                        {
                            PlusEnvironment.GetGame().GetQuestManager().Init();
                            break;
                        }
                    #endregion
                    #region :reload_vouchers/:update_vouchers
                    case "reload_vouchers":
                    case "update_vouchers":
                        {
                            PlusEnvironment.GetGame().GetCatalog().GetVoucherManager().Init();
                            break;
                        }
                    #endregion
                    #region :reload_bans/:update_bans
                    case "update_bans":
                    case "reload_bans":
                        {
                            PlusEnvironment.GetGame().GetModerationManager().ReCacheBans();
                            break;
                        }
                    #endregion
                    #endregion
    
                    default:
                        {
                            log.Error("Unrecognized MUS packet: '" + header + "'");
                            return;
                        }
                }
    
                log.Info("Successfully Parsed MUS command: '" + header + "'");
            }
        }
    }



Advertisement