Plus Emu Commands

May 1, 2015
467
152
I've been bored recently & just started coding commands into plus emu,

I'm sure some of you will find these useful.

Commands:
hug
balance
bancount
Enjoy,
Code:
public void hug(string[] Params)
        {
            string text = MergeParams(Params, 1);

            Habbo Habbo1 = this.Session.GetHabbo();
            if (Habbo1.CurrentRoom != null)
            {
                RoomUser User1 = Habbo1.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(Habbo1.Id);
                if (User1 != null)
                {
                    RoomUser User2 = Habbo1.CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(text);
                    if (User2 == null)
                    {
                        this.Session.SendWhisper("Open your eyes! " + text + " is not in the room.");
                        return;
                    }
                    else if (new Vector2D(User1.Coordinate.X, User1.Coordinate.Y).GetDistanceSquared(new Vector2D(User2.Coordinate.X, User2.Coordinate.Y)) > 2)
                    {
                        this.Session.SendWhisper("The user is too far away, try getting closer.");
                        return;
                    }
                    User1.Chat(User1.GetClient(), "*Hugs " + text + "*", true, 0);
                    User1.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(9);
                }
            }
        }
Code:
public void balance()
        {
            int Credits = Session.GetHabbo().Credits;
            int Pixels = Session.GetHabbo().ActivityPoints;
            uint Rank = Session.GetHabbo().Rank;
            string Output = String.Empty;

            using (IQueryAdapter Adapter = PlusEnvironment.GetDatabaseManager().getQueryreactor())
            {
                Adapter.runFastQuery("SELECT credits, activity_points, rank FROM users WHERE username = @Me");
                Adapter.addParameter("Me", Session.GetHabbo().Username);

                DataTable Table = Adapter.getTable();
                if (Table != null)
                {
                    Output += "Account Balance for " + Session.GetHabbo().Username + "\r";
                    Output += "--------------------------------\r";
                    Output += "Credits: " + Credits.ToString() + "\r";
                    Output += "Pixels: " + Pixels.ToString() + "\r";
                    Output += "Rank: " + Rank.ToString() + "\r";

                    Session.SendNotifWithScroll(Output);
                }
            }
        }
Code:
public void bancount()
        {
            int Count = 0;
            using (IQueryAdapter Adapter = PlusEnvironment.GetDatabaseManager().getQueryreactor())
            {
                Adapter.runFastQuery("SELECT id FROM bans");
                DataTable BanTable = Adapter.getTable();
                if (BanTable != null)
                {
                    Count = BanTable.Rows.Count;
                }
                Session.SendNotif(PlusEnvironment.HotelName + " Has saved you from Disguised & Dillon " + Count.ToString() + " times!");
            }
        }
 
May 1, 2015
467
152
How to add them?
Download Microsoft visual c# open up the source, should just be called Plus in the emulator folder,
Search for chatcommandhandler on the right solution explorer,
Paste the commands into there,
Find the region "Commands Start"
oVeaN6a.png

Then create a new region just above that
Do this,
Code:
#region
case "hug":
hug(Params);
return true;
break;
case "balance":
balance();
return true;
break;
case "bancount":
bancount();
return true;
break;
#endregion
:up:
 
May 1, 2015
467
152
Nice mate, can you also drop the AFK command?
When I get home, I will
Thanks,
 
When I get home, I will
Thanks,
Code:
public void afk()
        {
            Room room = Session.GetHabbo().CurrentRoom;
            RoomUser me = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (room == null || me == null)
                return;

            me.IsAsleep = true;
            me.Chat(Session, "*" + Session.GetHabbo().Username + " has gone idle*", true, 0);

            ServerMessage FallAsleep = new ServerMessage(486);
            FallAsleep.AppendInt32(me.VirtualId);
            FallAsleep.AppendBoolean(true);
            room.SendMessage(FallAsleep);
            return;
        }
Code:
public void back()
        {
            Room room = Session.GetHabbo().CurrentRoom;
            RoomUser me = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (room == null || me == null)
                return;

            me.IsAsleep = false;
            me.Chat(Session, "*" + Session.GetHabbo().Username + " is back from idle state*", true, 0);

            ServerMessage FallAsleep = new ServerMessage(486);
            FallAsleep.AppendInt32(me.VirtualId);
            FallAsleep.AppendBoolean(false);
            room.SendMessage(FallAsleep);
            return;
        }
 

Avduf

Member
Dec 24, 2012
153
5
Okay, but are you able to do a hug command at sledmores edit? If so i can show you the sources.
 

Tony Wolf

Member
Oct 6, 2011
321
20
When I get home, I will
Thanks,
 

Code:
public void afk()
        {
            Room room = Session.GetHabbo().CurrentRoom;
            RoomUser me = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (room == null || me == null)
                return;

            me.IsAsleep = true;
            me.Chat(Session, "*" + Session.GetHabbo().Username + " has gone idle*", true, 0);

            ServerMessage FallAsleep = new ServerMessage(486);
            FallAsleep.AppendInt32(me.VirtualId);
            FallAsleep.AppendBoolean(true);
            room.SendMessage(FallAsleep);
            return;
        }
Code:
public void back()
        {
            Room room = Session.GetHabbo().CurrentRoom;
            RoomUser me = room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);

            if (room == null || me == null)
                return;

            me.IsAsleep = false;
            me.Chat(Session, "*" + Session.GetHabbo().Username + " is back from idle state*", true, 0);

            ServerMessage FallAsleep = new ServerMessage(486);
            FallAsleep.AppendInt32(me.VirtualId);
            FallAsleep.AppendBoolean(false);
            room.SendMessage(FallAsleep);
            return;
        }
Can you help me to edit Plus Emulator to utf8?
 
May 1, 2015
467
152
due to high demand i've coded these for sledmore's plus edit.
Enjoy.
Code:
using System;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;
using Plus.Communication.Packets.Outgoing.Rooms.Chat;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
    class Hug : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_hug"; }
        }
        public string Parameters
        {
            get { return "%username%"; }
        }
        public string Description
        {
            get { return "Hug another user"; }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("You must enter a username!");
                return;
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Params[1]);
            if (TargetClient == null)
            {
                Session.SendWhisper("That user cannot be found, maybe they're offline or not in the room.");
                    return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
            {
                Session.SendWhisper("The user cannot be found, maybe they're offline or not in the room.");
                return;
            }
            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Username);
            if (User2 == null)
                return;

            if (!((Math.Abs(User.X - User2.X) >= 2 && (Math.Abs(User.Y - User2.Y) >= 2))))
            {

                Room.SendMessage(new ChatComposer(User.VirtualId, "Hugs " + User2 + "*", 0, User.LastBubble));
                User.ApplyEffect(9);
            }
            else
            {
                Session.SendWhisper("That user is too far away, try getting closer.");
                return;
            }
        }
    }
}
Code:
using System;
using System.Linq;
using Plus.Database.Interfaces;
using System.Data;

namespace Plus.HabboHotel.Rooms.Chat.Commands.User
{
    class BanCountCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_bancount"; }
        }
        public string Parameters
        {
            get { return ""; }
        }
        public string Description
        {
            get { return "See how many users are currently banned"; }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            int Count = 0;
            using (IQueryAdapter Adapter = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                Adapter.RunQuery("SELECT id FROM bans");
                DataTable BanTable = Adapter.getTable();
                if (BanTable != null)
                {
                    Count = BanTable.Rows.Count;
                }

                Session.SendNotification("Pace Has saved you from Disguised & Gilbert" + Count.ToString() + " times!");
            }
        }
    }
}
 
Last edited:

Users who are viewing this thread

Top