Closed

Unredable

Member
May 17, 2018
34
0
Hello I'm trying to do a count system that tells you what the user has got on the dice. I believe this is where you do it since I looked in to debug.

I'm trying to get room whisper.

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

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Items;

namespace Plus.Communication.Packets.Incoming.Rooms.Furni
{
class ThrowDiceEvent : IPacketEvent
{
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
{
Room Room = Session.GetHabbo().CurrentRoom;
if (Room == null)
return;

Item Item = Room.GetRoomItemHandler().GetItem(Packet.PopInt());
if (Item == null)
return;

Boolean hasRights = false;
if (Room.CheckRights(Session, false, true))
hasRights = true;

int request = Packet.PopInt();

Item.Interactor.OnTrigger(Session, Item, request, hasRights);
}
}
}
 
Something like: (Username) got number 4 on the dice
 
Last edited:

Brad

Well-Known Member
Jun 5, 2012
2,320
993
A Little bit pointless? as you can just use your eyes lol.

anyhow, goto InteractorDice.cs
below
Code:
Item.UpdateState(false, true);
Add
Code:
Session.SendWhisper(Session.GetHabbo().Username + " has rolled number " + Convert.ToString(Item.ExtraData));
 

Unredable

Member
May 17, 2018
34
0
Yes thank you but when I use the dice it tells me only user rolled -1 how may I fix this? The code is:
using System;

using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.GameClients;

namespace Plus.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);
Session.SendWhisper(Session.GetHabbo().Username + " slog nummer: " + Convert.ToString(Item.ExtraData));
Item.RequestUpdate(3, true);
}
}
}
else
{
User.MoveTo(Item.SquareInFront);
}
}

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

Joe

Well-Known Member
Jun 10, 2012
4,172
1,955
I remember a system that did all of this for you and gave the winner the spoils after the dice were rolled.

It’d be pretty good to have a system like this but saying dice rolls out loud would only help on scam occasions I gusss.
 

Unredable

Member
May 17, 2018
34
0
I remember a system that did all of this for you and gave the winner the spoils after the dice were rolled.

It’d be pretty good to have a system like this but saying dice rolls out loud would only help on scam occasions I gusss.
That's what I wanted haha, im trying to prevent scams
 

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
That's what I wanted haha, im trying to prevent scams
Really you should look into a system that the user can bet someone x amount of coins, that user accepts, it takes coins from both users and determines which user won based on dice rolls like Mycroft was saying
 

Unredable

Member
May 17, 2018
34
0
Really you should look into a system that the user can bet someone x amount of coins, that user accepts, it takes coins from both users and determines which user won based on dice rolls like Mycroft was saying
That's not what I was after, i'm trying to fix so that the text tell me the right dice number
 

Unredable

Member
May 17, 2018
34
0
Okay and I did this and my client disconnects me
else
{
Session.SendWhisper(Session.GetHabbo().Username + " has rolled number " + Convert.ToString(Item.ExtraData));
Item.ExtraData = "-1";
Item.UpdateState(false, true);
Item.RequestUpdate(3, true);
}
}
}
else
 

Users who are viewing this thread

Top