[PlusEMU] Appearing Offline With Command

Hypothesis

Programmer
Jan 6, 2019
524
361
Hey there DevBest, I just wanted to make a quick release. I was told that Plus Emulator didn't have a command to appear offline by default. I was confused because I recall the emulator I've been working on since 2016 having it. Come to find out, it actually does not in fact have appearing offline finished. I must've added it to mine sometime back and forgot I added it. It has the class for it in the Habbo composer, but there is no command or actual functionality of it, so I thought I'd release a working command for everyone to add to their edits, also provide a brief tutorial on how to get it working.

Navigate to /Communication/Packets/Outgoing/Users/ProfileInformationComposer.cs of your emulator and open that class file.
You must be registered for see images attach

Once you're in that class, you're going to look for the first line:
base.WriteBoolean((PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(habbo.Id)) != null); keep in mind, it might not actually look like this and your variable might be different than mine, but just look for something that looks like this in boolean data type.
You must be registered for see images attach

After you've found that, you're going to replace that line with this:
base.WriteBoolean(PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(habbo.Id) != null && !Data.AppearOffline ? true : false);

After you've done that, now you're gonna look for the integer type:
base.WriteInteger(Convert.ToInt32(PlusEnvironment.GetUnixTimestamp() - habbo.LastOnline));
You must be registered for see images attach

Replace that line with this:
base.WriteInteger(habbo.AppearOffline ? -1 : Convert.ToInt32(PlusEnvironment.GetUnixTimestamp() - habbo.LastOnline)); again, keep in mind that your variable might not be the same as mine.
After you've done that, you've finished the appearing offline function, so now you just add the command that sets the boolean to true or false, I've added the command I use below.
C#:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.Database.Interfaces;



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

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

        public string Description
        {
            get { return "Toggles your profile online status."; }
        }

        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AppearOffline = !Session.GetHabbo().AppearOffline;
            Session.SendWhisper("You are now appearing " + (Session.GetHabbo().AppearOffline == true ? "offline" : "online"));
        }
    }
}
After that, add the call for it in your CommandManager and you should be good to go. Hope this helped anyone who didn't have the command.
 

Users who are viewing this thread

Top