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
Server Releases
Plus EMU - Toll System
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="Altercationz" data-source="post: 405108" data-attributes="member: 59038"><p>Hi,</p><p>As requested by [USER=28869]@Brand[/USER] here is a working toll system, that only allows one toll per room due to diamonds / credits farming.</p><p>I was going to make a toll manager and fetch them all that way and allow many tolls per room, but don't want people gaining too much from this,</p><p>you can re-code it to allow many per room - completely up to you.</p><p>The cost can only be 1-15 diamonds, setting it to 0 cancels the toll.</p><p>I'm only releasing this because it isn't that much of a unique feature and doesn't mean anything to me at all.</p><p>Firstly, add this to your roomdata.cs</p><p>[CODE]public bool HasTollSet;</p><p>public int TollAmount;</p><p>Then further down add this,</p><p>this.HasTollSet = PlusEnvironment.EnumToBool(Row["toll_set"].ToString());</p><p> this.TollAmount = Convert.ToInt32(Row["toll_amount"]);</p><p>Just under this.PetMorphsAllowed = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());[/CODE]</p><p>Add the following to InteractorOneWayGate.cs</p><p>[CODE]</p><p> Room Room = User.GetClient().GetHabbo().CurrentRoom;</p><p> RoomUser RoomOwner = Room.GetRoomUserManager().GetRoomUserByHabbo(Room.OwnerId);</p><p> if (Room.HasTollSet)</p><p> {</p><p> int TollCost = Room.TollAmount;</p><p> if (User.GetClient().GetHabbo().Credits < TollCost)</p><p> {</p><p> User.GetClient().SendWhisper("You can not enter this gate because you do not have enough diamonds!");</p><p> return;</p><p> }</p><p> else</p><p> {</p><p> User.GetClient().SendWhisper("There is a toll on this gate! " + TollCost + " diamonds will be taken from your balance.");</p><p> User.GetClient().GetHabbo().Diamonds -= TollCost;</p><p> User.GetClient().SendMessage(new HabboActivityPointNotificationComposer(User.GetClient().GetHabbo().Diamonds, TollCost, 5));</p><p> // reward owner with toll</p><p> RoomOwner.GetClient().GetHabbo().Diamonds += TollCost;</p><p> RoomOwner.GetClient().SendMessage(new HabboActivityPointNotificationComposer(RoomOwner.GetClient().GetHabbo().Diamonds, TollCost, 5));</p><p> }</p><p> }</p><p>[/CODE]</p><p>Now finally, the set toll command.</p><p>[CODE]</p><p>using System;</p><p>using System.Collections.Generic;</p><p>using System.Linq;</p><p>using System.Text;</p><p>using System.Threading.Tasks;</p><p>using Plus.HabboHotel.GameClients;</p><p></p><p>namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun</p><p>{</p><p> class SetTollCommand : IChatCommand</p><p> {</p><p> public string PermissionRequired</p><p> {</p><p> get { return "command_set_toll"; }</p><p> }</p><p> public string Parameters</p><p> {</p><p> get { return "%price%"; }</p><p> }</p><p> public string Description</p><p> {</p><p> get { return "Set a toll on your one way gate"; }</p><p> }</p><p> public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)</p><p> {</p><p> if (Params.Length == 1)</p><p> {</p><p> Session.SendWhisper("You must enter a price for your one way gate!");</p><p> return;</p><p> }</p><p></p><p> RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);</p><p> int Cost;</p><p> Cost = int.Parse(Params[1]);</p><p></p><p> if (!Room.CheckRights(Session, true))</p><p> return;</p><p></p><p> if (Cost < 0 || Cost > 15)</p><p> {</p><p> Session.SendWhisper("The toll amount can only be 1-15 diamonds.");</p><p> return;</p><p> }</p><p></p><p> if (Cost == 0)</p><p> {</p><p> Session.SendWhisper("You have successfully removed your toll.");</p><p> Room.HasTollSet = false;</p><p> Room.TollAmount = 0;</p><p> return;</p><p> }</p><p> else</p><p> {</p><p> Session.SendNotification("You have succesfully set a toll of " + Cost + " diamonds on your one way gate.\r\n" +</p><p> "To Remove a toll, please use :toll 0 - only one poll per room is allowed.");</p><p> Room.HasTollSet = true;</p><p> Room.TollAmount = Cost;</p><p> return;</p><p> }</p><p> }</p><p> }</p><p>}</p><p>[/CODE]</p><p>Then add toll_set as an enum to your rooms table as well as toll_amount as an int.</p><p>That's all, enjoy.</p><p>P.S [USER=28869]@Brand[/USER] you're welcome <img src="/styles/default/xenforo/smilies/emojione/thumbsup.png" class="smilie" loading="lazy" alt=":up:" title="Thumbs Up :up:" data-shortname=":up:" /></p></blockquote><p></p>
[QUOTE="Altercationz, post: 405108, member: 59038"] Hi, As requested by [USER=28869]@Brand[/USER] here is a working toll system, that only allows one toll per room due to diamonds / credits farming. I was going to make a toll manager and fetch them all that way and allow many tolls per room, but don't want people gaining too much from this, you can re-code it to allow many per room - completely up to you. The cost can only be 1-15 diamonds, setting it to 0 cancels the toll. I'm only releasing this because it isn't that much of a unique feature and doesn't mean anything to me at all. Firstly, add this to your roomdata.cs [CODE]public bool HasTollSet; public int TollAmount; Then further down add this, this.HasTollSet = PlusEnvironment.EnumToBool(Row["toll_set"].ToString()); this.TollAmount = Convert.ToInt32(Row["toll_amount"]); Just under this.PetMorphsAllowed = PlusEnvironment.EnumToBool(Row["pet_morphs_allowed"].ToString());[/CODE] Add the following to InteractorOneWayGate.cs [CODE] Room Room = User.GetClient().GetHabbo().CurrentRoom; RoomUser RoomOwner = Room.GetRoomUserManager().GetRoomUserByHabbo(Room.OwnerId); if (Room.HasTollSet) { int TollCost = Room.TollAmount; if (User.GetClient().GetHabbo().Credits < TollCost) { User.GetClient().SendWhisper("You can not enter this gate because you do not have enough diamonds!"); return; } else { User.GetClient().SendWhisper("There is a toll on this gate! " + TollCost + " diamonds will be taken from your balance."); User.GetClient().GetHabbo().Diamonds -= TollCost; User.GetClient().SendMessage(new HabboActivityPointNotificationComposer(User.GetClient().GetHabbo().Diamonds, TollCost, 5)); // reward owner with toll RoomOwner.GetClient().GetHabbo().Diamonds += TollCost; RoomOwner.GetClient().SendMessage(new HabboActivityPointNotificationComposer(RoomOwner.GetClient().GetHabbo().Diamonds, TollCost, 5)); } } [/CODE] Now finally, the set toll command. [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Plus.HabboHotel.GameClients; namespace Plus.HabboHotel.Rooms.Chat.Commands.User.Fun { class SetTollCommand : IChatCommand { public string PermissionRequired { get { return "command_set_toll"; } } public string Parameters { get { return "%price%"; } } public string Description { get { return "Set a toll on your one way gate"; } } public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("You must enter a price for your one way gate!"); return; } RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id); int Cost; Cost = int.Parse(Params[1]); if (!Room.CheckRights(Session, true)) return; if (Cost < 0 || Cost > 15) { Session.SendWhisper("The toll amount can only be 1-15 diamonds."); return; } if (Cost == 0) { Session.SendWhisper("You have successfully removed your toll."); Room.HasTollSet = false; Room.TollAmount = 0; return; } else { Session.SendNotification("You have succesfully set a toll of " + Cost + " diamonds on your one way gate.\r\n" + "To Remove a toll, please use :toll 0 - only one poll per room is allowed."); Room.HasTollSet = true; Room.TollAmount = Cost; return; } } } } [/CODE] Then add toll_set as an enum to your rooms table as well as toll_amount as an int. That's all, enjoy. P.S [USER=28869]@Brand[/USER] you're welcome :up: [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
Server Releases
Plus EMU - Toll System
Top