- Thread Author
- #1
New command for (RedAge/NeptuneEvo)
This team fills absolutely all businesses with products in the amount of 10,000.
In the Commands.cs anywhere insert (next to other commands):
C#:
[Command("setproductforallbizz")]
public static void CMD_setProductForAllBiz(Player player)
{
try
{
if (player == null || !Main.Players.ContainsKey(player)) return;
BusinessManager.setProductForAllBiz(player);
}
catch (Exception e) { Log.Write("EXCEPTION AT \"CMD\":\n" + e.ToString(), nLog.Type.Error); }
}
C#:
public static void setProductForAllBiz(Player player)
{
if (!Group.CanUseCmd(player, "createbusiness")) return;
foreach (var b in BizList)
{
var biz = BizList[b.Key];
foreach (var prods in biz.Products)
{
prods.Lefts = 10000;
}
}
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы заполнили все бизнесы продуктами.", 3000);
Log.Write("All Businesses has been were filled", nLog.Type.Success);
}
C#:
C#:
[Command("setproductforallbizz")]
public static void CMD_setProductForAllBiz(ExtPlayer player)
{
try
{
if (!player.IsCharacterData()) return;
if (!CommandsAccess.CanUseCmd(player, AdminCommands.Givereds)) return;
var accountData = player.GetAccountData();
if (accountData == null) return;
string login = accountData.Login;
foreach (var b in BusinessManager.BizList)
{
var biz = BusinessManager.BizList[b.Key];
[HR][/HR]
In the BD table: adminaccess, write the command setproductforallbizz indicating the level of the admin panel
foreach (var prods in biz.Products)
{
prods.Lefts = 10000;
}
//biz.Save(); // сохраняем бизнес в бд
}
Trigger.SendChatMessage(player, "~r~Вы полностью пополнили склад бизнесов!");
}
catch (Exception e)
{
Log.Write($"CMD_setProductForAllBiz Exception: {e.ToString()}");
}
}