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
PlusEmu RCON commands
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="MayoMayn" data-source="post: 423006" data-attributes="member: 71840"><p>Basically I want a command that gives an user an item of x amount.</p><p>Currently I can only insert it through the cms and reload all inventories through rcon, which isn't what I want.</p><p></p><p>As I haven't gotten into the source code of Plus Emulator or the weird structure it would take too long to for me figure out.</p><p>This is as far as I've gotten:</p><p></p><p>[USER=591]@Sledmore[/USER] wrote something about using <strong>ItemFactory </strong>instead of [code] client.GetHabbo().GetInventoryComponent().AddNewItem(0, itemId) [/code]</p><p></p><p>Here's the code snippet for now:</p><p>[PHP]</p><p>using System;</p><p>using Plus.HabboHotel.GameClients;</p><p>using Plus.Database.Interfaces;</p><p>//using Plus.HabboHotel.Users.Inventory</p><p></p><p>namespace Plus.Communication.RCON.Commands.User</p><p>{</p><p> class GiveUserItemCommand : IRCONCommand</p><p> {</p><p></p><p> public string Description</p><p> {</p><p> get { return "This command is used to give a user a specific item."; }</p><p> }</p><p></p><p> public string Parameters</p><p> {</p><p> get { return "%userId% %itemId% %amount%"; }</p><p> }</p><p></p><p> public bool TryExecute(string[] parameters)</p><p> {</p><p> int userId = 0;</p><p> if (!int.TryParse(parameters[0].ToString(), out userId))</p><p> return false;</p><p></p><p> GameClient client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(userId);</p><p> if (client == null || client.GetHabbo() == null)</p><p> return false;</p><p></p><p> int itemId = 0;</p><p> if (!int.TryParse(parameters[1].ToString(), out itemId))</p><p> return false;</p><p></p><p> int amount = 0;</p><p> if (!int.TryParse(parameters[2].ToString(), out amount))</p><p> amount = 1;</p><p></p><p> while (amount > 0) {</p><p> client.GetHabbo().GetInventoryComponent().AddNewItem(0, itemId)</p><p></p><p> amount--;</p><p> }</p><p></p><p> return true;</p><p> }</p><p></p><p> }</p><p></p><p>}</p><p></p><p>[/PHP]</p></blockquote><p></p>
[QUOTE="MayoMayn, post: 423006, member: 71840"] Basically I want a command that gives an user an item of x amount. Currently I can only insert it through the cms and reload all inventories through rcon, which isn't what I want. As I haven't gotten into the source code of Plus Emulator or the weird structure it would take too long to for me figure out. This is as far as I've gotten: [USER=591]@Sledmore[/USER] wrote something about using [B]ItemFactory [/B]instead of [code] client.GetHabbo().GetInventoryComponent().AddNewItem(0, itemId) [/code] Here's the code snippet for now: [PHP] using System; using Plus.HabboHotel.GameClients; using Plus.Database.Interfaces; //using Plus.HabboHotel.Users.Inventory namespace Plus.Communication.RCON.Commands.User { class GiveUserItemCommand : IRCONCommand { public string Description { get { return "This command is used to give a user a specific item."; } } public string Parameters { get { return "%userId% %itemId% %amount%"; } } public bool TryExecute(string[] parameters) { int userId = 0; if (!int.TryParse(parameters[0].ToString(), out userId)) return false; GameClient client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(userId); if (client == null || client.GetHabbo() == null) return false; int itemId = 0; if (!int.TryParse(parameters[1].ToString(), out itemId)) return false; int amount = 0; if (!int.TryParse(parameters[2].ToString(), out amount)) amount = 1; while (amount > 0) { client.GetHabbo().GetInventoryComponent().AddNewItem(0, itemId) amount--; } return true; } } } [/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
PlusEmu RCON commands
Top