Altercationz
:)
Hi,
As requested by @Brand 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
Add the following to InteractorOneWayGate.cs
Now finally, the set toll command.
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 @Brand you're welcome
As requested by @Brand 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:
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:
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;
}
}
}
}
That's all, enjoy.
P.S @Brand you're welcome
Last edited: