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 Q&A
Convert Diamonds
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="Kodys" data-source="post: 390598" data-attributes="member: 71959"><p>Your post was the most pointless and retarded shit you've posted, yet.. you copied and pasted what he wrote and posted it back and claimed you was helping.. k</p><p></p><p>[spoiler=Bad attempt at tutorial kinda shit idk]</p><p>[USER=18160]@JMG[/USER] I've not tested this although I'm sure this should work, it also needs a new permission command_convert_diamonds but if you want use command_convert_credits tbh.</p><p>[code=c#]</p><p>using System;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Collections.Generic;</p><p>using System.Data;</p><p></p><p>using Plus.HabboHotel.Items;</p><p>using Plus.Communication.Packets.Outgoing.Inventory.Purse;</p><p>using Plus.Database.Interfaces;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User</p><p>{</p><p> class ConvertDiamondsCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_convert_diamonds"; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return ""; }</p><p> }</p><p></p><p> public string Description</p><p> {</p><p> get { return "Convert your exchangeable furniture into actual diamonds."; }</p><p> }</p><p></p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> int TotalValue = 0;</p><p></p><p> try</p><p> {</p><p> DataTable Table = null;</p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.SetQuery("SELECT `id` FROM `items` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND (`room_id`= '0' OR `room_id` = '')");</p><p> Table = dbClient.getTable();</p><p> }</p><p></p><p> if (Table == null)</p><p> {</p><p> Session.SendWhisper("You currently have no items in your inventory!");</p><p> return;</p><p> }</p><p></p><p> foreach (DataRow Row in Table.Rows)</p><p> {</p><p> Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Convert.ToInt32(Row[0]));</p><p> if (Item == null)</p><p> continue;</p><p></p><p> if (!Item.GetBaseItem().ItemName.StartsWith("what the diamond furniture starts with") && !Item.GetBaseItem().ItemName.StartsWith("is there any other diamond furniture maybe"))</p><p> continue;</p><p></p><p> if (Item.RoomId > 0)</p><p> continue;</p><p></p><p> string[] Split = Item.GetBaseItem().ItemName.Split('_');</p><p> int Value = int.Parse(Split[1]);</p><p></p><p> using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())</p><p> {</p><p> dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1");</p><p> }</p><p></p><p> Session.GetHabbo().GetInventoryComponent().RemoveItem(Item.Id);</p><p></p><p> TotalValue += Value;</p><p></p><p> if (Value > 0)</p><p> {</p><p> Session.GetHabbo().Diamonds += Value;</p><p> Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, Value, 5));</p><p> }</p><p> }</p><p></p><p> if (TotalValue > 0)</p><p> Session.SendNotification("All diamonds have successfully been converted!\r\r(Total value: " + TotalValue + " diamonds!");</p><p> else</p><p> Session.SendNotification("It appears you don't have any exchangeable items!");</p><p> }</p><p> catch</p><p> {</p><p> Session.SendNotification("Oops, an error occoured whilst converting your diamonds!");</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/code]</p><p>There are some strings that you'll need to change - I'd advice you to name all your diamond furniture something along the lines D_%VALUE%.</p><p>For example if you wanted to create a furni that's worth 250 diamonds and is a suitcase you'd run a query along the lines of... (I'm not good with furniture so I apologise if the query I supplied doesn't work)</p><p>[code=MySQL]</p><p>INSERT INTO `furniture` (`item_name`, `public_name`, `sprite_id`) VALUES ('D_250_suitcase', 'D_250_suitcase', '5461')</p><p>[/code]</p><p>As you can see it's named <strong>D_250_suitcase</strong>, the <strong>D_</strong> is what the command would search for (if you've set it to that) in the furniture so it knows it's an exchangeable diamond furni, the _ are used to split up the name <strong>250</strong> being the price which is converted to an int and the <strong>_suitcase</strong> is there in case you'd like to have other diamond exchangeable furni that exchanges into 250 diamonds, you'd name those things such as <strong>D_250_throne</strong>, <strong>D_250_duck</strong>.</p><p>Btw be sure to change the strings in <em>if (!Item.GetBaseItem().ItemName.StartsWith("what the diamond furniture starts with") && !Item.GetBaseItem().ItemName.StartsWith("is there any other diamond furniture maybe")) </em>to something like "D_" if you're using my query shit.</p><p></p><p>TLDR: Command checks for furni including whatever you want at the start, uses _ to split the string, grabs number after first _ in the furni name and puts that into the users purse. Name the furni something to easily identify it's exchangeable diamond furni using _ to split it up.</p><p>[/spoiler]</p><p>Tbh just PM me if that was too confusing - confusing myself a bit.</p></blockquote><p></p>
[QUOTE="Kodys, post: 390598, member: 71959"] Your post was the most pointless and retarded shit you've posted, yet.. you copied and pasted what he wrote and posted it back and claimed you was helping.. k [spoiler=Bad attempt at tutorial kinda shit idk] [USER=18160]@JMG[/USER] I've not tested this although I'm sure this should work, it also needs a new permission command_convert_diamonds but if you want use command_convert_credits tbh. [code=c#] using System; using System.Linq; using System.Text; using System.Collections.Generic; using System.Data; using Plus.HabboHotel.Items; using Plus.Communication.Packets.Outgoing.Inventory.Purse; using Plus.Database.Interfaces; namespace Plus.HabboHotel.Rooms.Chat.Commands.User { class ConvertDiamondsCommand : IChatCommand { public string PermissionRequired { get { return "command_convert_diamonds"; } } public string Parameters { get { return ""; } } public string Description { get { return "Convert your exchangeable furniture into actual diamonds."; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { int TotalValue = 0; try { DataTable Table = null; using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.SetQuery("SELECT `id` FROM `items` WHERE `user_id` = '" + Session.GetHabbo().Id + "' AND (`room_id`= '0' OR `room_id` = '')"); Table = dbClient.getTable(); } if (Table == null) { Session.SendWhisper("You currently have no items in your inventory!"); return; } foreach (DataRow Row in Table.Rows) { Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(Convert.ToInt32(Row[0])); if (Item == null) continue; if (!Item.GetBaseItem().ItemName.StartsWith("what the diamond furniture starts with") && !Item.GetBaseItem().ItemName.StartsWith("is there any other diamond furniture maybe")) continue; if (Item.RoomId > 0) continue; string[] Split = Item.GetBaseItem().ItemName.Split('_'); int Value = int.Parse(Split[1]); using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("DELETE FROM `items` WHERE `id` = '" + Item.Id + "' LIMIT 1"); } Session.GetHabbo().GetInventoryComponent().RemoveItem(Item.Id); TotalValue += Value; if (Value > 0) { Session.GetHabbo().Diamonds += Value; Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Diamonds, Value, 5)); } } if (TotalValue > 0) Session.SendNotification("All diamonds have successfully been converted!\r\r(Total value: " + TotalValue + " diamonds!"); else Session.SendNotification("It appears you don't have any exchangeable items!"); } catch { Session.SendNotification("Oops, an error occoured whilst converting your diamonds!"); } } } } [/code] There are some strings that you'll need to change - I'd advice you to name all your diamond furniture something along the lines D_%VALUE%. For example if you wanted to create a furni that's worth 250 diamonds and is a suitcase you'd run a query along the lines of... (I'm not good with furniture so I apologise if the query I supplied doesn't work) [code=MySQL] INSERT INTO `furniture` (`item_name`, `public_name`, `sprite_id`) VALUES ('D_250_suitcase', 'D_250_suitcase', '5461') [/code] As you can see it's named [B]D_250_suitcase[/B], the [B]D_[/B] is what the command would search for (if you've set it to that) in the furniture so it knows it's an exchangeable diamond furni, the _ are used to split up the name [B]250[/B] being the price which is converted to an int and the [B]_suitcase[/B] is there in case you'd like to have other diamond exchangeable furni that exchanges into 250 diamonds, you'd name those things such as [B]D_250_throne[/B], [B]D_250_duck[/B]. Btw be sure to change the strings in [I]if (!Item.GetBaseItem().ItemName.StartsWith("what the diamond furniture starts with") && !Item.GetBaseItem().ItemName.StartsWith("is there any other diamond furniture maybe")) [/I]to something like "D_" if you're using my query shit. TLDR: Command checks for furni including whatever you want at the start, uses _ to split the string, grabs number after first _ in the furni name and puts that into the users purse. Name the furni something to easily identify it's exchangeable diamond furni using _ to split it up. [/spoiler] Tbh just PM me if that was too confusing - confusing myself a bit. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Convert Diamonds
Top