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
Gold Tree Emulator Edited
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="Jaden" data-source="post: 313322" data-attributes="member: 51705"><p>Why Are you using Try/Catch for your hug command etc, Makes no sense tbh.</p><p>[CODE]case 135:</p><p> try</p><p> {</p><p> RoomUser class6;</p><p> if (!(ServerConfiguration.UnknownBoolean2 || Session.GetHabbo().HasFuse("cmd_enable")))</p><p> {</p><p> Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("cmd_error_disabled"));</p><p> return true;</p><p> }</p><p> if (!(Session.GetHabbo().IsVIP || Session.GetHabbo().HasFuse("cmd_enable")))</p><p> {</p><p> Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("cmd_error_permission_vip"));</p><p> return true;</p><p> }</p><p> string text = Params[1];</p><p> TargetClient = GoldTree.GetGame().GetClientManager().GetClientByHabbo(text);</p><p> class2 = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);</p><p> if (Session == null || TargetClient == null)</p><p> {</p><p> return false;</p><p> }</p><p> class6 = class2.GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> RoomUser class4 = class2.GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username)</p><p> {</p><p> Session.GetHabbo().Whisper("You Cannot Hug Yourself");</p><p> return true;</p><p> }</p><p> if (TargetClient.GetHabbo().CurrentRoomId == Session.GetHabbo().CurrentRoomId && Math.Abs(class6.X - class4.X) < 3 && Math.Abs(class6.Y - class4.Y) < 3)</p><p> {</p><p> class4.HandleSpeech(Session, "* Hug By " + Session.GetHabbo().Username + " *", true);</p><p> class4.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2(168, true);</p><p> }</p><p> Session.GetHabbo().Whisper("That user is not close enough for you to hug, try getting closer");</p><p> return true;</p><p> }</p><p> catch</p><p> {</p><p> return false;</p><p> }[/CODE]</p><p>+ All these extra if statements for no reason... Clean up dude, Heres what i've tried for you.</p><p>[CODE] case 135:</p><p> {</p><p> if (Session.GetHabbo().HasFuse("cmd_hug")) {</p><p> TargetClient = GoldTree.GetGame().GetClientManager().GetClientByHabbo(Params[1]);</p><p> class2 = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);</p><p> RoomUser class6 = class2.GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> RoomUser class4 = class2.GetRoomUserByHabbo(TargetClient.GetHabbo().Id);</p><p> if (Math.Abs(class6.X - class4.X) < 3 && Math.Abs(class6.Y - class4.Y) < 3) {</p><p> class6.HandleSpeech(Session, "*Wraps my arms around " + TargetClient.GetHabbo().Username + "*", false);</p><p> return true;</p><p> } else {</p><p> Session.GetHabbo().Whisper("Oops... This user is too far away! Try getting closer.");</p><p> }</p><p> }</p><p> }[/CODE]</p></blockquote><p></p>
[QUOTE="Jaden, post: 313322, member: 51705"] Why Are you using Try/Catch for your hug command etc, Makes no sense tbh. [CODE]case 135: try { RoomUser class6; if (!(ServerConfiguration.UnknownBoolean2 || Session.GetHabbo().HasFuse("cmd_enable"))) { Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("cmd_error_disabled")); return true; } if (!(Session.GetHabbo().IsVIP || Session.GetHabbo().HasFuse("cmd_enable"))) { Session.GetHabbo().Whisper(GoldTreeEnvironment.GetExternalText("cmd_error_permission_vip")); return true; } string text = Params[1]; TargetClient = GoldTree.GetGame().GetClientManager().GetClientByHabbo(text); class2 = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); if (Session == null || TargetClient == null) { return false; } class6 = class2.GetRoomUserByHabbo(Session.GetHabbo().Id); RoomUser class4 = class2.GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username) { Session.GetHabbo().Whisper("You Cannot Hug Yourself"); return true; } if (TargetClient.GetHabbo().CurrentRoomId == Session.GetHabbo().CurrentRoomId && Math.Abs(class6.X - class4.X) < 3 && Math.Abs(class6.Y - class4.Y) < 3) { class4.HandleSpeech(Session, "* Hug By " + Session.GetHabbo().Username + " *", true); class4.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2(168, true); } Session.GetHabbo().Whisper("That user is not close enough for you to hug, try getting closer"); return true; } catch { return false; }[/CODE] + All these extra if statements for no reason... Clean up dude, Heres what i've tried for you. [CODE] case 135: { if (Session.GetHabbo().HasFuse("cmd_hug")) { TargetClient = GoldTree.GetGame().GetClientManager().GetClientByHabbo(Params[1]); class2 = GoldTree.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId); RoomUser class6 = class2.GetRoomUserByHabbo(Session.GetHabbo().Id); RoomUser class4 = class2.GetRoomUserByHabbo(TargetClient.GetHabbo().Id); if (Math.Abs(class6.X - class4.X) < 3 && Math.Abs(class6.Y - class4.Y) < 3) { class6.HandleSpeech(Session, "*Wraps my arms around " + TargetClient.GetHabbo().Username + "*", false); return true; } else { Session.GetHabbo().Whisper("Oops... This user is too far away! Try getting closer."); } } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Gold Tree Emulator Edited
Top