Any Working Rig Command?

Status
Not open for further replies.

xXTrevXx

Member
Dec 29, 2015
66
3
Does anyone know of any Rig Dice commands for Plus Emu? the one for JayCustoms, and all others dont really work T-T its just for experimental purposes, not anything legit. Any help is always appreciated :)
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
The one I released does work lol... I still have it in my emulator. It's the most dynamic rig command released because you can rig someone's next 15 rolls and they would never know...?
 

xXTrevXx

Member
Dec 29, 2015
66
3
Last time i tried it, the dice just kept rolling every time you roll them. I guess i can try again?


Edit:
Yes the dice just continue to roll, constantly, they dont stop. I didnt even use the command yet..
@JayCustom


Edit 2:

Emu throwing off an error



Line 998 of my Item.cs


My Habbo.cs
 
Last edited:

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
My guess is InteractingClient isn't finding you... Underneath GameClient InteractingClient =

Put:
If(InteractingClient == null)
Console.WriteLine("null");
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
aye, here.
RigCommand.cs
Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace Emulator.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class RigCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_rig"; }
        }

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

        public string Description
        {
            get { return "Allows you to carry a hand item"; }
        }

        public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
        {


            if (!Session.GetHabbo().GetPermissions().HasCommand("command_rig"))
            {
                Session.SendWhisper("Oops, you do not have the 'command_rig`.");
                return;
            }
            if (Params.Length == 1)
            {
                Session.SendWhisper("You must enter the number you want to rig. For example; :rig 4 will roll the number 4.");
                return;
            }

            if (!int.TryParse(Convert.ToString(Params[1]), out int Number))
            {
                Session.SendWhisper("Please enter a valid integer.");
                return;
            }

            Session.GetHabbo().RigDice = true;
            Session.GetHabbo().DiceNumber = Number;
            Session.SendWhisper("Your dice is now rigged for one roll only.");
        }
    }
}

add these to Habbo.cs
Code:
private bool _rigDice;
private int _diceNumber;

public bool RigDice
        {
            get { return this._rigDice; }
            set { this._rigDice = value; }
        }

        public int DiceNumber
        {
            get { return this._diceNumber; }
            set { this._diceNumber = value; }
        }

Replace your InteractorDice.cs with this
Code:
using System;

using Emulator.HabboHotel.Rooms;
using Emulator.HabboHotel.GameClients;

namespace Emulator.HabboHotel.Items.Interactor
{
    public class InteractorDice : IFurniInteractor
    {
        public void OnPlace(GameClient Session, Item Item)
        {
            if (Item.ExtraData == "-1")
            {
                Item.ExtraData = "0";
                Item.UpdateNeeded = true;
            }
        }

        public void OnRemove(GameClient Session, Item Item)
        {
            if (Item.ExtraData == "-1")
            {
                Item.ExtraData = "0";
            }
        }

        public void OnTrigger(GameClient Session, Item Item, int Request, bool HasRights)
        {
            RoomUser User = null;
            if (Session != null)
                User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
            if (User == null)
                return;

            if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))
            {
                if (Item.ExtraData != "-1")
                {
                    if (Request == -1)
                    {
                        Item.ExtraData = "0";
                        Item.UpdateState();
                    }
                    else
                    {
                        Item.ExtraData = "-1";
                        Item.UpdateState(false, true);
                        if(Session.GetHabbo().DiceNumber > 0)
                            Item.ExtraData = Convert.ToString(Session.GetHabbo().DiceNumber);
                        Item.RequestUpdate(3, true);
                        Session.GetHabbo().DiceNumber = 0;
                        Session.GetHabbo().RigDice = false;
                    }
                }
            }
            else
            {
                User.MoveTo(Item.SquareInFront);
            }
        }

        public void OnWiredTrigger(Item Item)
        {
            Item.ExtraData = "-1";
            Item.UpdateState(false, true);
            Item.RequestUpdate(4, true);
        }
    }
}
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Using @Westyy code, I just changed a few things...

1) Description updated
2) Added check for number between 1 and 6
3) Removed check to see if they have a command, its not needed due to the command being loaded into the users commands based on the parameter for permission

Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace Emulator.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class RigCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_rig"; }
        }

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

        public string Description
        {
            get { return "Allows you to rig the next number for yourself"; }
        }

        public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("You must enter the number you want to rig. For example; :rig 4 will roll the number 4.");
                return;
            }

            if (!int.TryParse(Convert.ToString(Params[1]), out int Number))
            {
                Session.SendWhisper("Please enter a valid integer.");
                return;
            }

            if(Number < 1 || Number > 6){
                Session.SendWhisper("Your number must be between 1 and 6");
                return;
            }

            Session.GetHabbo().RigDice = true;
            Session.GetHabbo().DiceNumber = Number;
            Session.SendWhisper("Your dice is now rigged for one roll only.");
        }
    }
}
 
Update: You can actually make this even more tidy by doing this:

Instead of:

Code:
 Session.GetHabbo().RigDice = true;
            Session.GetHabbo().DiceNumber = Number;
            Session.SendWhisper("Your dice is now rigged for one roll only.");

Code:
Session.GetHabbo().DiceNumber = Number;
Session.SendWhisper("Your next roll is now rigged for " + Number);

Remove the boolean all together (It's not checked in the Item class anyway, its just set to false)

My only concern with this code, is it looks like the original dice code was removed?
 

Brad

Well-Known Member
Jun 5, 2012
2,320
993
Using @Westyy code, I just changed a few things...

1) Description updated
2) Added check for number between 1 and 6
3) Removed check to see if they have a command, its not needed due to the command being loaded into the users commands based on the parameter for permission

Code:
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace Emulator.HabboHotel.Rooms.Chat.Commands.Administrator
{
    class RigCommand : IChatCommand
    {
        public string PermissionRequired
        {
            get { return "command_rig"; }
        }

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

        public string Description
        {
            get { return "Allows you to rig the next number for yourself"; }
        }

        public void Execute(GameClients.GameClient Session, Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("You must enter the number you want to rig. For example; :rig 4 will roll the number 4.");
                return;
            }

            if (!int.TryParse(Convert.ToString(Params[1]), out int Number))
            {
                Session.SendWhisper("Please enter a valid integer.");
                return;
            }

            if(Number < 1 || Number > 6){
                Session.SendWhisper("Your number must be between 1 and 6");
                return;
            }

            Session.GetHabbo().RigDice = true;
            Session.GetHabbo().DiceNumber = Number;
            Session.SendWhisper("Your dice is now rigged for one roll only.");
        }
    }
}
 
Update: You can actually make this even more tidy by doing this:

Instead of:

Code:
 Session.GetHabbo().RigDice = true;
            Session.GetHabbo().DiceNumber = Number;
            Session.SendWhisper("Your dice is now rigged for one roll only.");

Code:
Session.GetHabbo().DiceNumber = Number;
Session.SendWhisper("Your next roll is now rigged for " + Number);

Remove the boolean all together (It's not checked in the Item class anyway, its just set to false)

My only concern with this code, is it looks like the original dice code was removed?
I had the boolean there when I coded it a little differently, when the rig would save for multiple rolls and other plans. I never add the checks and didn't find need, due to only owners having the command, so if you tried anything else, that's just being dumb. Anyhow, if you do plan on letting mods etc use this use JayCustoms code. And no, the original code wasn't removed.

this is the original.
Code:
if (Item.ExtraData != "-1")
                {
                    if (Request == -1)
                    {
                        Item.ExtraData = "0";
                        Item.UpdateState();
                    }
                    else
                    {
                        Item.ExtraData = "-1";
                        Item.UpdateState(false, true);
                        Item.RequestUpdate(3, true);
                    }
                }
 

xXTrevXx

Member
Dec 29, 2015
66
3
Thank you Westyy, it works like a charm :D
And thank you JayCustoms also for the help, i will use that if i decide to let mods use it
im going to see if i can look at it, and modify it so your able to use more than 1 number?, a string of rigs, idk how well that will work, since im just starting out with commands.
if im not able to figure it out, would i be able to ask you for a bit of help?
 
Last edited:
Status
Not open for further replies.

Users who are viewing this thread

Top