Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
[COMMAND] Add LTD (catalog)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Pollak" data-source="post: 454038" data-attributes="member: 77990"><p style="text-align: center"><strong>Hi!</strong> I coded this command and now I want to share it for everyone. <img src="/styles/default/xenforo/smilies/emojione/smile.png" class="smilie" loading="lazy" alt=":)" title="Smile :)" data-shortname=":)" /></p> <p style="text-align: center"></p> <p style="text-align: center"><strong>1</strong>- HabboHotel>Rooms>Chat>Commands>Administrator and enter a new code with the name LTDCommand.cs</p> <p style="text-align: center"></p> <p style="text-align: center"></p> <p style="text-align: center">[CODE=csharp]#region</p> <p style="text-align: center">using Plus.HabboHotel.Items;</p> <p style="text-align: center">using Plus.Core;</p> <p style="text-align: center">using Plus.HabboHotel.GameClients;</p> <p style="text-align: center">using System;</p> <p style="text-align: center">using System.Collections.Generic;</p> <p style="text-align: center">using System.Linq;</p> <p style="text-align: center">using System.Text;</p> <p style="text-align: center">using System.Threading.Tasks;</p> <p style="text-align: center">using Plus.Database.Interfaces;</p> <p style="text-align: center">using System.Data;</p> <p style="text-align: center">using Plus.Utilities;</p> <p style="text-align: center">using Plus.Communication.Packets.Outgoing.Notifications;</p> <p style="text-align: center">#endregion</p> <p style="text-align: center"></p> <p style="text-align: center">namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator</p> <p style="text-align: center">{</p> <p style="text-align: center"> internal class LTDCommand : IChatCommand</p> <p style="text-align: center"> {</p> <p style="text-align: center"> public string PermissionRequired => "command_add_ltd";</p> <p style="text-align: center"></p> <p style="text-align: center"> public string Parameters => "%variable%";</p> <p style="text-align: center"></p> <p style="text-align: center"> public string Description => "";</p> <p style="text-align: center"></p> <p style="text-align: center"> public void Execute(GameClient Session, Room Room, string[] Params)</p> <p style="text-align: center"> {</p> <p style="text-align: center"> if (Params.Length == 1)</p> <p style="text-align: center"> {</p> <p style="text-align: center"> Session.SendWhisper("Oops, enter the variable name! ': ltd list'");</p> <p style="text-align: center"> return;</p> <p style="text-align: center"> }</p> <p style="text-align: center"></p> <p style="text-align: center"> int randNum = RandomNumber.GenerateNewRandom(35000, 45000);</p> <p style="text-align: center"></p> <p style="text-align: center"> StringBuilder builder = new StringBuilder();</p> <p style="text-align: center"></p> <p style="text-align: center"> var Variables = Params[1];</p> <p style="text-align: center"> switch (Variables.ToLower())</p> <p style="text-align: center"> {</p> <p style="text-align: center"> case "lista":</p> <p style="text-align: center"> case "list":</p> <p style="text-align: center"> case "help":</p> <p style="text-align: center"> case "ajuda":</p> <p style="text-align: center"> {</p> <p style="text-align: center"> builder.Append("List of currently available options:\n\n");</p> <p style="text-align: center"> builder.Append("add -> Stand in front of Furni and type the command ' :ltd add '\n");</p> <p style="text-align: center"> builder.Append("remove -> Updates the current LTD of this page to the sold out LTD page!\n");</p> <p style="text-align: center"> builder.Append("NOTE: Configure in the server_limited_edition (database) table the settings.");</p> <p style="text-align: center"></p> <p style="text-align: center"> Session.SendMessage(new MOTDNotificationComposer(builder.ToString()));</p> <p style="text-align: center"> break;</p> <p style="text-align: center"> }</p> <p style="text-align: center"> case "adicionar":</p> <p style="text-align: center"> case "add":</p> <p style="text-align: center"> {</p> <p style="text-align: center"> RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p> <p style="text-align: center"> List<Item> Items = Room.GetGameMap().GetAllRoomItemForSquare(User.SquareInFront.X, User.SquareInFront.Y);</p> <p style="text-align: center"> foreach (Item _item in Items)</p> <p style="text-align: center"> {</p> <p style="text-align: center"> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p> <p style="text-align: center"> {</p> <p style="text-align: center"> dbClient.SetQuery("SELECT * FROM `server_limited_edition` LIMIT 1");</p> <p style="text-align: center"> DataTable table = dbClient.getTable();</p> <p style="text-align: center"></p> <p style="text-align: center"> foreach (DataRow row in table.Rows)</p> <p style="text-align: center"> {</p> <p style="text-align: center"> int PriceCredits = Convert.ToInt32(row["price_credits"]);</p> <p style="text-align: center"> int PriceDuckets = Convert.ToInt32(row["price_duckets"]);</p> <p style="text-align: center"> int PriceDiamonds = Convert.ToInt32(row["price_diamonds"]);</p> <p style="text-align: center"> int PriceGotw = Convert.ToInt32(row["price_gotw"]);</p> <p style="text-align: center"> int LimitedStack = Convert.ToInt32(row["limited_stack"]);</p> <p style="text-align: center"> int LtdLimit = Convert.ToInt32(row["ltd_limit"]);</p> <p style="text-align: center"> int PageId = Convert.ToInt32(row["page_id"]);</p> <p style="text-align: center"></p> <p style="text-align: center"> dbClient.runFastQuery("INSERT INTO `catalog_items` (id, page_id, item_id, catalog_name, cost_credits, cost_pixels, cost_diamonds, cost_gotw, limited_stack) VALUES ('" + randNum + "', '" + PageId + "', '" + _item.Data.Id + "', '" + _item.Data.PublicName + "', '" + PriceCredits + "', '" + PriceDuckets + "', '" + PriceDiamonds + "', '" + PriceGotw + "', '" + LimitedStack + "')");</p> <p style="text-align: center"></p> <p style="text-align: center"> Session.SendWhisper("Item " + _item.Data.PublicName + " has been successfully added to the catalog!");</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center"></p> <p style="text-align: center"> break;</p> <p style="text-align: center"> }</p> <p style="text-align: center"> case "remover":</p> <p style="text-align: center"> case "remove":</p> <p style="text-align: center"> case "mover":</p> <p style="text-align: center"> case "move":</p> <p style="text-align: center"> {</p> <p style="text-align: center"> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p> <p style="text-align: center"> {</p> <p style="text-align: center"> dbClient.SetQuery("SELECT * FROM `server_limited_edition` LIMIT 1");</p> <p style="text-align: center"> DataTable table = dbClient.getTable();</p> <p style="text-align: center"></p> <p style="text-align: center"> foreach (DataRow row in table.Rows)</p> <p style="text-align: center"> {</p> <p style="text-align: center"> int PageId = Convert.ToInt32(row["page_id"]);</p> <p style="text-align: center"> int SoldPageId = Convert.ToInt32(row["sold_page_id"]);</p> <p style="text-align: center"></p> <p style="text-align: center"> if (SoldPageId != 0)</p> <p style="text-align: center"> {</p> <p style="text-align: center"> dbClient.runFastQuery("UPDATE catalog_items SET page_id='" + SoldPageId + "' WHERE page_id='" + PageId + "'");</p> <p style="text-align: center"></p> <p style="text-align: center"> Session.SendWhisper("Current Limited Edition LTD page is now on the Rare Out of Stock (Page " + Convert.ToString(SoldPageId) + ") page");</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center"> break;</p> <p style="text-align: center"> }</p> <p style="text-align: center"> default:</p> <p style="text-align: center"> {</p> <p style="text-align: center"> Session.SendWhisper(Params[1] + " is not an existing variable!");</p> <p style="text-align: center"> break;</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center"> }</p> <p style="text-align: center">}[/CODE]</p><p></p><p style="text-align: center"><strong>2</strong>- HabboHotel>Rooms>Chat>Commands in CommandManager.cs</p> <p style="text-align: center">Search for private void RegisterAdministrator() and enter:</p> <p style="text-align: center"></p> <p style="text-align: center">[CODE]this.Register("ltd", new LTDCommand());[/CODE]</p> <p style="text-align: center"></p> <p style="text-align: center"><strong>3</strong>- </p> <p style="text-align: center">Then debug everything you entered.</p> <p style="text-align: center">Then go to your database (db) in the permissions_commands table and enter:</p> <p style="text-align: center"></p> <p style="text-align: center">[CODE]INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES ('command_add_ltd', '8', '0');[/CODE]</p> <p style="text-align: center"></p> <p style="text-align: center"><strong>4</strong>- Insert the table into your database.</p> <p style="text-align: center"></p> <p style="text-align: center">[CODE]CREATE TABLE IF NOT EXISTS `server_limited_edition` (</p> <p style="text-align: center"> `id` int(11) unsigned NOT NULL AUTO_INCREMENT,</p> <p style="text-align: center"> `page_id` int(11) NOT NULL DEFAULT '510',</p> <p style="text-align: center"> `sold_page_id` int(11) NOT NULL,</p> <p style="text-align: center"> `limited_stack` int(5) NOT NULL DEFAULT '25',</p> <p style="text-align: center"> `price_credits` int(5) NOT NULL DEFAULT '0',</p> <p style="text-align: center"> `price_duckets` int(5) NOT NULL DEFAULT '0',</p> <p style="text-align: center"> `price_diamonds` int(5) NOT NULL DEFAULT '0',</p> <p style="text-align: center"> `price_gotw` int(5) NOT NULL DEFAULT '0',</p> <p style="text-align: center"> PRIMARY KEY (`id`)</p> <p style="text-align: center">) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;</p> <p style="text-align: center"></p> <p style="text-align: center">INSERT INTO `server_limited_edition` (`id`, `page_id`, `sold_page_id`, `limited_stack`, `price_credits`, `price_duckets`, `price_diamonds`, `price_gotw`) VALUES (1, 510, 0, 10, 10, 0, 15, 0);[/CODE]</p> <p style="text-align: center"></p> <p style="text-align: center">If you have questions just comment! I appreciate your attention!</p> <p style="text-align: center"></p> <p style="text-align: center">CREDITS:</p> <p style="text-align: center"><strong>Snaiker (Pollak)</strong></p></blockquote><p></p>
[QUOTE="Pollak, post: 454038, member: 77990"] [CENTER][B]Hi![/B] I coded this command and now I want to share it for everyone. :) [B]1[/B]- HabboHotel>Rooms>Chat>Commands>Administrator and enter a new code with the name LTDCommand.cs [CODE=csharp]#region using Plus.HabboHotel.Items; using Plus.Core; using Plus.HabboHotel.GameClients; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Plus.Database.Interfaces; using System.Data; using Plus.Utilities; using Plus.Communication.Packets.Outgoing.Notifications; #endregion namespace Plus.HabboHotel.Rooms.Chat.Commands.Administrator { internal class LTDCommand : IChatCommand { public string PermissionRequired => "command_add_ltd"; public string Parameters => "%variable%"; public string Description => ""; public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Oops, enter the variable name! ': ltd list'"); return; } int randNum = RandomNumber.GenerateNewRandom(35000, 45000); StringBuilder builder = new StringBuilder(); var Variables = Params[1]; switch (Variables.ToLower()) { case "lista": case "list": case "help": case "ajuda": { builder.Append("List of currently available options:\n\n"); builder.Append("add -> Stand in front of Furni and type the command ' :ltd add '\n"); builder.Append("remove -> Updates the current LTD of this page to the sold out LTD page!\n"); builder.Append("NOTE: Configure in the server_limited_edition (database) table the settings."); Session.SendMessage(new MOTDNotificationComposer(builder.ToString())); break; } case "adicionar": case "add": { RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); List<Item> Items = Room.GetGameMap().GetAllRoomItemForSquare(User.SquareInFront.X, User.SquareInFront.Y); foreach (Item _item in Items) { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `server_limited_edition` LIMIT 1"); DataTable table = dbClient.getTable(); foreach (DataRow row in table.Rows) { int PriceCredits = Convert.ToInt32(row["price_credits"]); int PriceDuckets = Convert.ToInt32(row["price_duckets"]); int PriceDiamonds = Convert.ToInt32(row["price_diamonds"]); int PriceGotw = Convert.ToInt32(row["price_gotw"]); int LimitedStack = Convert.ToInt32(row["limited_stack"]); int LtdLimit = Convert.ToInt32(row["ltd_limit"]); int PageId = Convert.ToInt32(row["page_id"]); dbClient.runFastQuery("INSERT INTO `catalog_items` (id, page_id, item_id, catalog_name, cost_credits, cost_pixels, cost_diamonds, cost_gotw, limited_stack) VALUES ('" + randNum + "', '" + PageId + "', '" + _item.Data.Id + "', '" + _item.Data.PublicName + "', '" + PriceCredits + "', '" + PriceDuckets + "', '" + PriceDiamonds + "', '" + PriceGotw + "', '" + LimitedStack + "')"); Session.SendWhisper("Item " + _item.Data.PublicName + " has been successfully added to the catalog!"); } } } break; } case "remover": case "remove": case "mover": case "move": { using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT * FROM `server_limited_edition` LIMIT 1"); DataTable table = dbClient.getTable(); foreach (DataRow row in table.Rows) { int PageId = Convert.ToInt32(row["page_id"]); int SoldPageId = Convert.ToInt32(row["sold_page_id"]); if (SoldPageId != 0) { dbClient.runFastQuery("UPDATE catalog_items SET page_id='" + SoldPageId + "' WHERE page_id='" + PageId + "'"); Session.SendWhisper("Current Limited Edition LTD page is now on the Rare Out of Stock (Page " + Convert.ToString(SoldPageId) + ") page"); } } } break; } default: { Session.SendWhisper(Params[1] + " is not an existing variable!"); break; } } } } }[/CODE][/CENTER] [CENTER][B]2[/B]- HabboHotel>Rooms>Chat>Commands in CommandManager.cs Search for private void RegisterAdministrator() and enter: [CODE]this.Register("ltd", new LTDCommand());[/CODE] [B]3[/B]- Then debug everything you entered. Then go to your database (db) in the permissions_commands table and enter: [CODE]INSERT INTO `permissions_commands` (`command`, `group_id`, `subscription_id`) VALUES ('command_add_ltd', '8', '0');[/CODE] [B]4[/B]- Insert the table into your database. [CODE]CREATE TABLE IF NOT EXISTS `server_limited_edition` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `page_id` int(11) NOT NULL DEFAULT '510', `sold_page_id` int(11) NOT NULL, `limited_stack` int(5) NOT NULL DEFAULT '25', `price_credits` int(5) NOT NULL DEFAULT '0', `price_duckets` int(5) NOT NULL DEFAULT '0', `price_diamonds` int(5) NOT NULL DEFAULT '0', `price_gotw` int(5) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; INSERT INTO `server_limited_edition` (`id`, `page_id`, `sold_page_id`, `limited_stack`, `price_credits`, `price_duckets`, `price_diamonds`, `price_gotw`) VALUES (1, 510, 0, 10, 10, 0, 15, 0);[/CODE] If you have questions just comment! I appreciate your attention! CREDITS: [B]Snaiker (Pollak)[/B][/CENTER] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
[COMMAND] Add LTD (catalog)
Top