Nice release
This is a discussion on [ButterFly r96] Sit Command within the Habbo Releases forums, part of the Habbo Hotel category; I was trying to add Jacobs sit command to the butterfly emu but I found that it needed some editing ...
I was trying to add Jacobs sit command to the butterfly emu but I found that it needed some editing and some additional code to make it work.
I got it working and will show you how to add it. Maybe this will start the trend of people posting code snippets for Bfly just like they used to do for Uber.
I know it's a simple release but it works:)
Alright, lets get started:
First open system/commands.ini
At the bottom add:
Now open system/commands_register.iniPHP Code:[sit]
sit.minrank=1
sit.description=Makes your avatar sit
sit.prefix=
sit.input=sit
sit.clubs=
At the bottom add:
Open ChatCommandRegister.cs and find:PHP Code:sit=69
Below that add:PHP Code:case 68:
{
commandHandler.Fly();
break;
}
Open ChatCommandHandler.cs and find:PHP Code:case 69:
{
commandHandler.sit();
break;
}
Below that add:PHP Code:#region Commands
Open RoomUser.cs and find:PHP Code:internal void sit()
{
Room TargetRoom = Session.GetHabbo().CurrentRoom;
RoomUser TargetRoomUser = null;
int tries = 0;
TargetRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (!TargetRoomUser.Statusses.ContainsKey("sit"))
{
if ((TargetRoomUser.RotBody % 2) == 0)
{
if (TargetRoomUser == null)
{
return;
}
try
{
TargetRoomUser.Statusses.Add("sit", "1.0");
TargetRoomUser.Z -= 0.35;
TargetRoomUser.isSitting = true;
TargetRoomUser.UpdateNeeded = true;
}
catch { }
return;
}
else
{
if (tries <= 1)
{
TargetRoomUser.RotBody--;
tries++;
sit();
}
else
{
Session.SendNotif("You cannot sit diagonally, try it again please");
tries = 0;
}
}
}
else if (TargetRoomUser.isSitting == true)
{
TargetRoomUser.Z += 0.35;
TargetRoomUser.Statusses.Remove("sit");
TargetRoomUser.Statusses.Remove("1.0");
TargetRoomUser.isSitting = false;
TargetRoomUser.UpdateNeeded = true;
}
}
Below that add:PHP Code:internal bool isFlying = false;
Now open RoomUserManagaer.cs and find:PHP Code:internal bool isSitting = false;
Below that add:PHP Code:double nextZ = room.GetGameMap().SqAbsoluteHeight(nextX, nextY);
Credits to T09 for fixing it up a little.PHP Code:if (User.isSitting == true)
{
User.Statusses.Remove("sit");
User.Z += 0.35;
User.isSitting = false;
User.UpdateNeeded = true;
}
I think that's about it :)
Don't flame I know it's simple.![]()
Last edited by leenster; 03-07-12 at 02:06 AM.
Nice release
Last edited by CobraSnip; 05-07-12 at 04:46 AM.
Thanks Leenster! Going to add it now Butterfly FTW!
Edit: got it to work :P
![]()
Last edited by PRIZM; 29-06-12 at 05:46 AM.
It's nice that you're contributing really. But still, that sit command is kinda stupid.. sitting in the air?
Want to re-live the oldschool Habbo experience? Play Wobble? Use the camera?
Visit puddihotel.net for a change.
I fixed wired for butterfly and a good catalogue
demo: rabbo-hotel.nl
Want to re-live the oldschool Habbo experience? Play Wobble? Use the camera?
Visit puddihotel.net for a change.
What about making addons to Butterfly?
Nvm, fixed lol
EDIT: not fixed, still can't create rooms
Last edited by Bapestar; 29-06-12 at 09:13 AM.
.
I fixed the code to be working fine (if you stand on a platform you'll sit at that height, you can't stand on chairs, adapted sit height), I only get credits for the small modifications. Tutorial and bfly compability go to leenster and base goes to jacob.
Remove all of his code and do the following:
First open system/commands.ini
At the bottom add:
Now open system/commands_register.iniPHP Code:[sit]
sit.minrank=1
sit.description=Makes your avatar sit
sit.prefix=
sit.input=sit
sit.clubs=
At the bottom add:
Open ChatCommandRegister.cs and find:PHP Code:sit=69
Below that add:PHP Code:case 68:
{
commandHandler.Fly();
break;
}
Open ChatCommandHandler.cs and find:PHP Code:case 69:
{
commandHandler.sit();
break;
}
Below that add:PHP Code:#region Commands
Open RoomUser.cs and find:PHP Code:internal void sit()
{
InitTimer();
Room TargetRoom = Session.GetHabbo().CurrentRoom;
RoomUser TargetRoomUser = null;
int tries = 0;
TargetRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (!TargetRoomUser.Statusses.ContainsKey("sit"))
{
if ((TargetRoomUser.RotBody % 2) == 0)
{
if (TargetRoomUser == null)
{
return;
}
try
{
TargetRoomUser.Statusses.Add("sit", "1.0");
TargetRoomUser.Z -= 0.35;
TargetRoomUser.isSitting = true;
TargetRoomUser.UpdateNeeded = true;
}
catch { }
return;
}
else
{
if (tries <= 1)
{
TargetRoomUser.RotBody--;
tries++;
sit();
}
else
{
Session.SendNotif("You cannot sit diagonally, try it again please");
tries = 0;
}
}
}
else if (TargetRoomUser.isSitting == true)
{
TargetRoomUser.Z += 0.35;
TargetRoomUser.Statusses.Remove("sit");
TargetRoomUser.Statusses.Remove("1.0");
TargetRoomUser.isSitting = false;
TargetRoomUser.UpdateNeeded = true;
}
}
private Timer timer1;
public void InitTimer()
{
timer1 = new Timer();
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 1000; // in miliseconds
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
isSitting();
}
internal void isSitting()
{
Room TargetRoom = Session.GetHabbo().CurrentRoom;
RoomUser TargetRoomUser = null;
TargetRoom = ButterflyEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
TargetRoomUser = TargetRoom.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (TargetRoomUser.isSitting == true && !TargetRoomUser.Statusses.ContainsKey("sit"))
{
TargetRoomUser.isSitting = false;
}
}
Below that add:PHP Code:internal bool isFlying = false;
Now open RoomUserManagaer.cs and find:PHP Code:internal bool isSitting = false;
Below that add:PHP Code:double nextZ = room.GetGameMap().SqAbsoluteHeight(nextX, nextY);
PHP Code:if (User.isSitting == true)
{
User.Statusses.Remove("sit");
User.Z += 0.35;
User.isSitting = false;
User.UpdateNeeded = true;
}