What does set state do?Does anyone have SetState command for Plus R1?
it sets state of furni upon placing to given status id.What does set state do?
add me on discord, i'll give you my setstate code i'm on plus r1 Bran#3021Does anyone have SetState command for Plus R1?
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Plus.HabboHotel.Rooms;
using Plus.HabboHotel.Rooms.Games;
using Plus.HabboHotel.Rooms.Games.TEAMs;
using Plus.HabboHotel.Rooms.Notifications;
namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun
{
class SetStateCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_setst"; }
}
public string Parameters
{
get { return "%sId%"; }
}
public string Description
{
get { return "Gives you the ability to set a default item state!"; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
RoomUser user = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (user == null)
{
NotificationManager.SimpleNotification(Session, "User not found.");
return;
}
if (Params.Length == 1 && user.ItemState > 0 )
{
user.ItemState = 0;
NotificationManager.Whisper(Session, "Your default item state has been reset.");
return;
}
if (Params.Length == 1)
{
NotificationManager.Whisper(Session, "You must include a number after :setst.");
return;
}
if (!int.TryParse(Params[1], out int StateId))
{
NotificationManager.Whisper(Session, "Invalid input, please enter a number only.");
return;
}
if (StateId < 1 || StateId > 8)
{
NotificationManager.Whisper(Session, "Please enter a state between 1-8.");
return;
}
NotificationManager.Whisper(Session, "Your default item state has been set to " + Convert.ToString(StateId));
user.ItemState = StateId;
}
}
}
bool state = false;
int istate = 0;
if (user != null)
state = user.ItemState > 0;
if (state)
istate = user.ItemState;
replace
if (newItem)
{
if (_floorItems.ContainsKey(Item.Id))
{
if (Session != null)
Session.SendNotification(HabboEnvironment.GetLanguageManager().TryGetValue("room.item.already_placed"));
_room.GetGameMap().RemoveFromMap(Item);
return true;
}
if (state)
Item.ExtraData = Convert.ToString(istate);
if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id))
_floorItems.TryAdd(Item.Id, Item);
else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id))
_wallItems.TryAdd(Item.Id, Item);
if (sendMessage)
_room.SendMessage(new ObjectAddComposer(Item, _room));
}
sent it to him alreadySetStateCommand.cs
Obviously replace NotifManager with how you handle notifs.PHP:using System; using System.Linq; using System.Text; using System.Collections.Generic; using Plus.HabboHotel.Rooms; using Plus.HabboHotel.Rooms.Games; using Plus.HabboHotel.Rooms.Games.TEAMs; using Plus.HabboHotel.Rooms.Notifications; namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun { class SetStateCommand : IChatCommand { public string PermissionRequired { get { return "command_setst"; } } public string Parameters { get { return "%sId%"; } } public string Description { get { return "Gives you the ability to set a default item state!"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { RoomUser user = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); if (user == null) { NotificationManager.SimpleNotification(Session, "User not found."); return; } if (Params.Length == 1 && user.ItemState > 0 ) { user.ItemState = 0; NotificationManager.Whisper(Session, "Your default item state has been reset."); return; } if (Params.Length == 1) { NotificationManager.Whisper(Session, "You must include a number after :setst."); return; } if (!int.TryParse(Params[1], out int StateId)) { NotificationManager.Whisper(Session, "Invalid input, please enter a number only."); return; } if (StateId < 1 || StateId > 8) { NotificationManager.Whisper(Session, "Please enter a state between 1-8."); return; } NotificationManager.Whisper(Session, "Your default item state has been set to " + Convert.ToString(StateId)); user.ItemState = StateId; } } }
Then in RoomItemHandling.cs
add these inside SetFloorItem
Code:bool state = false; int istate = 0; if (user != null) state = user.ItemState > 0; if (state) istate = user.ItemState; replace if (newItem) { if (_floorItems.ContainsKey(Item.Id)) { if (Session != null) Session.SendNotification(HabboEnvironment.GetLanguageManager().TryGetValue("room.item.already_placed")); _room.GetGameMap().RemoveFromMap(Item); return true; } if (state) Item.ExtraData = Convert.ToString(istate); if (Item.IsFloorItem && !_floorItems.ContainsKey(Item.Id)) _floorItems.TryAdd(Item.Id, Item); else if (Item.IsWallItem && !_wallItems.ContainsKey(Item.Id)) _wallItems.TryAdd(Item.Id, Item); if (sendMessage) _room.SendMessage(new ObjectAddComposer(Item, _room)); }