using System;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections.Generic;
using Plus.HabboHotel.Users;
using Plus.HabboHotel.GameClients;
using Plus.Database.Interfaces;
using Plus.Communication.Packets.Outgoing.Notifications;
namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator
{
class SearchFurniCommand : IChatCommand
{
public string PermissionRequired
{
get { return "command_enable"; }
}
public string Parameters
{
get { return ""; }
}
public string Description
{
get { return "Locate catalog items containing a certain name"; }
}
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
{
StringBuilder b = new StringBuilder();
b.Append("Listed items containing " + Params[1] + "\n\n");
using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
{
db.SetQuery("SELECT * FROM `catalog_items` WHERE `public_name` LIKE '%" + Params[1] + "%'");
db.RunQuery();
DataTable t = db.getTable();
foreach (DataRow r in t.Rows)
{
b.Append("You found: " + Convert.ToString(r["public_name"]) + " listed in: " + Convert.ToString(r["page_id"]) + "\n");
}
}
Session.SendMessage(new MOTDNotificationComposer(b.ToString()));
}
}
}
Thats amazing. I always go on hotels, and see a messy catalog and can never find the item I want. I hope retros atleast catch on to this concept. Good job.Probably not the most efficient way to code something like this, but it works, tested on my hotel.
Basically what this does is it selects items from the catalog that contain a certain string.
An example would be :searchfurni Iced, this will return all furniture names containing Iced along with their page ID, you could further this and have it collect the page name instead of the page ID, but this is just the basic score of it.
C#:using System; using System.Linq; using System.Text; using System.Data; using System.Collections.Generic; using Plus.HabboHotel.Users; using Plus.HabboHotel.GameClients; using Plus.Database.Interfaces; using Plus.Communication.Packets.Outgoing.Notifications; namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator { class SearchFurniCommand : IChatCommand { public string PermissionRequired { get { return "command_enable"; } } public string Parameters { get { return ""; } } public string Description { get { return "Locate catalog items containing a certain name"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { StringBuilder b = new StringBuilder(); b.Append("Listed items containing " + Params[1] + "\n\n"); using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { db.SetQuery("SELECT * FROM `catalog_items` WHERE `public_name` LIKE '%" + Params[1] + "'%"); db.RunQuery(); DataTable t = db.getTable(); foreach (DataRow r in t.Rows) { b.Append("You found: " + Convert.ToString(r["public_name"]) + " listed in: " + Convert.ToString(r["page_id"]) + "\n"); } } Session.SendMessage(new MOTDNotificationComposer(b.ToString())); } } }
Only thing I'd improve is removing the query. The catalog items are already cached on the server. Other than that, it's a fantastic command with room to do some much more with it.Probably not the most efficient way to code something like this, but it works, tested on my hotel.
Basically what this does is it selects items from the catalog that contain a certain string.
An example would be :searchfurni Iced, this will return all furniture names containing Iced along with their page ID, you could further this and have it collect the page name instead of the page ID, but this is just the basic score of it.
C#:using System; using System.Linq; using System.Text; using System.Data; using System.Collections.Generic; using Plus.HabboHotel.Users; using Plus.HabboHotel.GameClients; using Plus.Database.Interfaces; using Plus.Communication.Packets.Outgoing.Notifications; namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator { class SearchFurniCommand : IChatCommand { public string PermissionRequired { get { return "command_enable"; } } public string Parameters { get { return ""; } } public string Description { get { return "Locate catalog items containing a certain name"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { StringBuilder b = new StringBuilder(); b.Append("Listed items containing " + Params[1] + "\n\n"); using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { db.SetQuery("SELECT * FROM `catalog_items` WHERE `public_name` LIKE '%" + Params[1] + "'%"); db.RunQuery(); DataTable t = db.getTable(); foreach (DataRow r in t.Rows) { b.Append("You found: " + Convert.ToString(r["public_name"]) + " listed in: " + Convert.ToString(r["page_id"]) + "\n"); } } Session.SendMessage(new MOTDNotificationComposer(b.ToString())); } } }
or just tell the owner to sort their shit out and fix their catalogue ahahaThats amazing. I always go on hotels, and see a messy catalog and can never find the item I want. I hope retros atleast catch on to this concept. Good job.
You code is not workProbably not the most efficient way to code something like this, but it works, tested on my hotel.
Basically what this does is it selects items from the catalog that contain a certain string.
An example would be :searchfurni Iced, this will return all furniture names containing Iced along with their page ID, you could further this and have it collect the page name instead of the page ID, but this is just most basic start of it.
C#:using System; using System.Linq; using System.Text; using System.Data; using System.Collections.Generic; using Plus.HabboHotel.Users; using Plus.HabboHotel.GameClients; using Plus.Database.Interfaces; using Plus.Communication.Packets.Outgoing.Notifications; namespace Plus.HabboHotel.Rooms.Chat.Commands.Moderator { class SearchFurniCommand : IChatCommand { public string PermissionRequired { get { return "command_enable"; } } public string Parameters { get { return ""; } } public string Description { get { return "Locate catalog items containing a certain name"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { StringBuilder b = new StringBuilder(); b.Append("Listed items containing " + Params[1] + "\n\n"); using (IQueryAdapter db = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { db.SetQuery("SELECT * FROM `catalog_items` WHERE `public_name` LIKE '%" + Params[1] + "'%"); db.RunQuery(); DataTable t = db.getTable(); foreach (DataRow r in t.Rows) { b.Append("You found: " + Convert.ToString(r["public_name"]) + " listed in: " + Convert.ToString(r["page_id"]) + "\n"); } } Session.SendMessage(new MOTDNotificationComposer(b.ToString())); } } }
what emulator are you usingYou code is not work
Make sure you add the command to CommandManager.cs as well. Also, this command is coded for Plus Emulator, so if you're not using Plus, then that might be why.You code is not work
if it's based on plus shouldn't it work?Im using slopt emulator i dont work you code.. Slopt is based on plus emulator
You’re not adding it right then. Did you register it on commandmanager and update your permissions table? Just tested this on localhost and it’s working.Im using slopt emulator i dont work you code.. Slopt is based on plus emulator
I can help you over Teamviewer, just add my Discord: Dayz#5319Im using slopt emulator i dont work you code.. Slopt is based on plus emulator
You command is work thanks for your helpI can help you over Teamviewer, just add my Discord: Joseph#8099
not sure why it wouldn't work for you.