Цена? Не?а что тут такого?
не особо и большая цена.2 раза в KFC сходить поестьЦена? Не?
Не просто так акцентировал внимание на цене.
ну так купи, че просить то? не большая же цена. Не покушаешь два раза. Зато купишь. Во народ, говорят не большая, а сами купить не могут. Не смешил бы народ, ребенок)не особо и большая цена.2 раза в KFC сходить поесть
да купить то куплю, только сливать не буду если уж тут все такие жадные )ну так купи, че просить то? не большая же цена. Не покушаешь два раза. Зато купишь. Во народ, говорят не большая, а сами купить не могут. Не смешил бы народ, ребенок)
Не, ну а че?да купить то куплю, только сливать не буду если уж тут все такие жадные )
так а смысл мне сливать если тут жмотят ) - если был бы такой, кто слил не грех было бы ему лично что-то другое(ему нужное) слитьНе, ну а че?
Купил - теперь сливай!
Или после покупки стало жалко, да?
Особенно если оставят без обновлений.
Так наверно жмотят потому что нет.так а смысл мне сливать если тут жмотят ) - если был бы такой, кто слил не грех было бы ему лично что-то другое(ему нужное) слить
ищу плагин лавка грибника и фермер (как на тревеле) даже не слованную версию.Обновлю за бесплатно
using System;
using System.Collections.Generic;
using System.Linq;
using Oxide.Core;
using Oxide.Core.Plugins;
using Oxide.Game.Rust.Cui;
using UnityEngine;
using System.Globalization;
using Color = UnityEngine.Color;
namespace Oxide.Plugins
{
[Info("Лавка грибника", "Tyger", "10.0.0")]
class MushroomPicker : RustPlugin
{
#region [Вспомогательный код / Helper Code]
private static string HexToRustFormat(string hex) { if (string.IsNullOrEmpty(hex)) { hex = "#FFFFFFFF"; } var str = hex.Trim('#'); if (str.Length == 6) str += "FF"; if (str.Length != 8) { throw new Exception(hex); throw new InvalidOperationException("Cannot convert a wrong format."); } var r = byte.Parse(str.Substring(0, 2), NumberStyles.HexNumber); var g = byte.Parse(str.Substring(2, 2), NumberStyles.HexNumber); var b = byte.Parse(str.Substring(4, 2), NumberStyles.HexNumber); var a = byte.Parse(str.Substring(6, 2), NumberStyles.HexNumber); Color color = new Color32(r, g, b, a); return string.Format("{0:F2} {1:F2} {2:F2} {3:F2}", color.r, color.g, color.b, color.a); }
#endregion
#region [Локализация / Localization]
string Message(string key, string playerId = null) => lang.GetMessage(key, this, playerId);
private Dictionary<string, string> Messages = new Dictionary<string, string>
{
["SUCCESFUL_B"] = "Вы приобрели контейнер.",
["UNSUCCESFUL_B"] = "У вас не хватает грибов на покупку контейнера.",
};
#endregion
#region [База данных / DataBase]
private StoredData DataBase = new StoredData();
class StoredData
{
public Dictionary<ulong, StatisticDB> StatisticDB = new Dictionary<ulong, StatisticDB>();
}
class StatisticDB
{
public string Name;
public ulong SteamID;
public int Mushrooms;
public StatisticDB()
{
}
}
private void SaveData() => Interface.Oxide.DataFileSystem.WriteObject(Name, DataBase);
private void LoadData()
{
try
{
DataBase = Interface.GetMod().DataFileSystem.ReadObject<StoredData>(Name);
}
catch (Exception e)
{
DataBase = new StoredData();
}
}
#endregion
#region [Переменные / Variables]
public string Layer = "Box";
public bool AdvertsOn;
private string Blur = "assets/content/ui/uibackgroundblur.mat";
#endregion
#region [Референсы / References]
[PluginReference] Plugin ImageLibrary;
private string GetImg(string name)
{
return (string)ImageLibrary?.Call("GetImage", name) ?? "";
}
#endregion
#region [Интерфейс / Interface]
CuiElementContainer Gui = new CuiElementContainer();
void DrawMushrooms(BasePlayer player)
{
CuiElementContainer Gui = new CuiElementContainer();
Gui.Add(new CuiPanel
{ CursorEnabled = true,
Image ={Color = HexToRustFormat("#37373733"),Material = Blur},
RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1",}
}, "Overlay", Layer);
Gui.Add(new CuiButton
{ Button =
{Command = "closegrib",Color = "0 0 0 0"},
Text ={Text = ""},
RectTransform ={AnchorMin = "0 0", AnchorMax = "1 1"}
}, Layer, "CloseButton");
Gui.Add(new CuiElement
{ Name = "Zagolovok",
Parent = Layer,
Components = {
new CuiTextComponent{Text = "Лавка грибника",FontSize = 50,Align = TextAnchor.MiddleCenter,Color = "1 1 1 1"},
new CuiRectTransformComponent{AnchorMin = "0 0.6750006",AnchorMax = "1 0.7675932"},
new CuiOutlineComponent{ Color = HexToRustFormat("#000000B7"),Distance = "0.5 0.5",}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("firstcase")},
new CuiRectTransformComponent{AnchorMin = "0.01041667 0.3703703",AnchorMax = "0.1979167 0.6518519"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("secondcase")},
new CuiRectTransformComponent{AnchorMin = "0.2083333 0.3703703",AnchorMax = "0.3958333 0.6518519"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("thirdcase")},
new CuiRectTransformComponent{AnchorMin = "0.40625 0.3703703",AnchorMax = "0.59375 0.6518519"}
} });
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("fourcase")},
new CuiRectTransformComponent { AnchorMin = "0.6041667 0.3703703", AnchorMax = "0.7916667 0.6518519"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("fivecase")},
new CuiRectTransformComponent
{AnchorMin = "0.8020834 0.3703703",AnchorMax = "0.9895834 0.6518519"}
}});
Gui.Add(new CuiButton
{ Button ={Command = $"buyboxes {0}",Color = HexToRustFormat("#2DCE5BFF")},
Text ={Color = "1 1 1 1",Text = "КУПИТЬ",Align = TextAnchor.MiddleCenter,FontSize = 35},
RectTransform ={AnchorMin = "0.01041667 0.3120368",AnchorMax = "0.1979167 0.3657406"}
}, Layer, "GribButton"); ;
Gui.Add(new CuiButton
{ Button ={Command = $"buyboxes {1}",Color = HexToRustFormat("#2DCE5BFF")},
Text ={Color = "1 1 1 1",Text = "КУПИТЬ",Align = TextAnchor.MiddleCenter,FontSize = 35},
RectTransform ={AnchorMin = "0.2083333 0.3120368",AnchorMax = "0.3958333 0.3657406"}
}, Layer, "GribButton");
Gui.Add(new CuiButton
{ Button ={Command = $"buyboxes {2}",Color = HexToRustFormat("#2DCE5BFF")},
Text ={Color = "1 1 1 1",Text = "КУПИТЬ",Align = TextAnchor.MiddleCenter,FontSize = 35},
RectTransform = {AnchorMin = "0.40625 0.3120368",AnchorMax = "0.59375 0.3657406"}
}, Layer, "GribButton");
Gui.Add(new CuiButton
{ Button ={Command = $"buyboxes {3}",Color = HexToRustFormat("#2DCE5BFF")},
Text ={ Color = "1 1 1 1", Text = "КУПИТЬ", Align = TextAnchor.MiddleCenter, FontSize = 35},
RectTransform =
{AnchorMin = "0.6041667 0.3120368", AnchorMax = "0.7916667 0.3657406"}
}, Layer, "GribButton");
Gui.Add(new CuiButton
{ Button ={Command = $"buyboxes {4}", Color = HexToRustFormat("#2DCE5BFF")},
Text = { Color = "1 1 1 1", Text = "КУПИТЬ", Align = TextAnchor.MiddleCenter, FontSize = 35},
RectTransform ={ AnchorMin = "0.8020834 0.3120368",AnchorMax = "0.9895834 0.3657406"}
}, Layer, "GribButton");
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiImageComponent{Color = HexToRustFormat("#3737377A")},
new CuiRectTransformComponent{AnchorMin = "0.8020834 0.1638889",AnchorMax = "0.9895834 0.2972219"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiRawImageComponent{ Color = "1 1 1 1",Png = GetImg("mushroom")},
new CuiRectTransformComponent{AnchorMin = "0.809375 0.16944445",AnchorMax = "0.8895833 0.2898148"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiTextComponent{Text = $"<b>: {DataBase.StatisticDB[player.userID].Mushrooms}</b>", Align = TextAnchor.MiddleCenter, FontSize = 50},
new CuiRectTransformComponent
{ AnchorMin = "0.895832 0.1694444",AnchorMax = "0.9760403 0.2898148"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components = {
new CuiImageComponent{Color = HexToRustFormat("#3737377B"), },
new CuiRectTransformComponent
{ AnchorMin = "0.01041667 0.1638889", AnchorMax = "0.7921875 0.2972219"}
}});
Gui.Add(new CuiElement
{ Name = "MushroomElem",
Parent = Layer,
Components ={
new CuiTextComponent{Text = $"<b>Чтобы открыть хотя бы один контейнер, вам требуется собрать определенное количество грибов которое написано на одном из ящиков.</b>", Align = TextAnchor.MiddleCenter,FontSize = 32},
new CuiRectTransformComponent{ AnchorMin = "0.01041667 0.1638889", AnchorMax = "0.7921875 0.2972219" }
}});
CuiHelper.AddUi(player, Gui);
}
#endregion
#region [Команда / Commands]
[ConsoleCommand("buyboxes")]
void buybox(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
int i = int.Parse(args.Args[0]);
System.Random rnd = new System.Random();
switch (i)
{
case 0:
if (DataBase.StatisticDB[player.userID].Mushrooms >= 100)
{
for (int d = 0; d < 7; d++)
{
var item = ListStoGribov[rnd.Next(ListStoGribov.Count())];
ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain);
}
DataBase.StatisticDB[player.userID].Mushrooms -= 100;
SendReply(player, Message("SUCCESFUL_B"));
SaveData();
CuiHelper.DestroyUi(player, Layer);
}
else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer);
break;
case 1:
if (DataBase.StatisticDB[player.userID].Mushrooms >= 300)
{
for (int d = 0; d < 6; d++)
{
var item = ListTristaGribov[rnd.Next(ListTristaGribov.Count())];
ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain);
}
DataBase.StatisticDB[player.userID].Mushrooms -= 300;
SendReply(player, Message("SUCCESFUL_B"));
SaveData();
CuiHelper.DestroyUi(player, Layer);
}
else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer);
break;
case 2:
if (DataBase.StatisticDB[player.userID].Mushrooms >= 500)
{
for (int d = 0; d < 6; d++)
{
var item = ListpyatsotGribov[rnd.Next(ListpyatsotGribov.Count())];
ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain);
}
DataBase.StatisticDB[player.userID].Mushrooms -= 500;
SendReply(player, Message("SUCCESFUL_B"));
SaveData();
CuiHelper.DestroyUi(player, Layer);
}
else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer);
break;
case 3:
if (DataBase.StatisticDB[player.userID].Mushrooms >= 700)
{
for (int d = 0; d < 5; d++)
{
var item = ListsemsotGribov[rnd.Next(ListsemsotGribov.Count())];
ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain);
}
DataBase.StatisticDB[player.userID].Mushrooms -= 700;
SendReply(player, Message("SUCCESFUL_B"));
SaveData();
CuiHelper.DestroyUi(player, Layer);
}
else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer);
break;
case 4:
if (DataBase.StatisticDB[player.userID].Mushrooms >= 900)
{
for (int d = 0; d < 5; d++)
{
var item = ListvosemsotGribov[rnd.Next(ListvosemsotGribov.Count())];
ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain);
}
DataBase.StatisticDB[player.userID].Mushrooms -= 900;
SendReply(player, Message("SUCCESFUL_B"));
SaveData();
CuiHelper.DestroyUi(player, Layer);
}
else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer);
break;
}
}
[ChatCommand("grib")]
void gribsettings(BasePlayer player)
{
if (player == null) DrawMushrooms(player);
else DrawMushrooms(player);
}
[ConsoleCommand("gribs")]
void givegribs(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
if (player.IsAdmin)
{
DataBase.StatisticDB[player.userID].Mushrooms += 500;
SaveData();
}
else SendReply(player, "no");
}
[ConsoleCommand("closegrib")]
void closegrib(ConsoleSystem.Arg args)
{
BasePlayer player = args.Player();
CuiHelper.DestroyUi(player, Layer);
}
#endregion
#region [Предметы / Items]
class Items
{
public string shortname;
public int amount;
}
List<Items> ListStoGribov = new List<Items>
{
new Items {shortname = "scrap", amount = 500},
new Items {shortname = "workbench1", amount = 1},
new Items {shortname = "riflebody", amount = 5},
new Items {shortname = "pistol.python", amount = 1},
new Items {shortname = "pistol.eoka", amount = 1},
new Items {shortname = "keycard_red", amount = 1},
new Items {shortname = "jackhammer", amount = 1},
new Items {shortname = "crossbow", amount = 1},
new Items {shortname = "box.repair.bench", amount = 1},
new Items {shortname = "ammo.rocket.basic", amount = 1},
new Items {shortname = "coffeecan.helmet", amount = 1},
new Items {shortname = "furnace", amount = 1},
new Items {shortname = "heavy.plate.helmet", amount = 1},
new Items {shortname = "heavy.plate.jacket", amount = 1},
new Items {shortname = "heavy.plate.pants", amount = 1},
new Items {shortname = "pickaxe", amount = 1},
new Items {shortname = "syringe.medical", amount = 1},
new Items {shortname = "weapon.mod.silencer", amount = 1},
new Items {shortname = "xmas.tree", amount = 1},
new Items {shortname = "weapon.mod.muzzlebrakee", amount = 1},
new Items {shortname = "wall.frame.garagedoor", amount = 1},
new Items {shortname = "tool.camera", amount = 1},
new Items {shortname = "trap.landmine", amount = 1},
new Items {shortname = "targeting.computer", amount = 1},
new Items {shortname = "shotgun.waterpipe", amount = 1},
};
List<Items> ListTristaGribov = new List<Items>
{
new Items {shortname = "workbench2", amount = 1},
new Items {shortname = "smg.mp5", amount = 1},
new Items {shortname = "smgbody", amount = 5},
new Items {shortname = "scrap", amount = 550},
new Items {shortname = "ammo.rocket.basic", amount = 3},
new Items {shortname = "shotgun.double", amount = 1},
new Items {shortname = "shotgun.spas12", amount = 1},
new Items {shortname = "shotgun.pump", amount = 1},
new Items {shortname = "weapon.mod.small.scope", amount = 1},
new Items {shortname = "xmas.present.large", amount = 1},
new Items {shortname = "sulfur.ore", amount = 3000},
new Items {shortname = "rifle.m39", amount = 1},
new Items {shortname = "pistol.m92", amount = 1},
new Items {shortname = "pistol.semiauto", amount = 1},
new Items {shortname = "rifle.semiauto", amount = 1},
new Items {shortname = "jackhammer", amount = 1},
new Items {shortname = "chainsaw", amount = 1},
new Items {shortname = "heavy.plate.jacket", amount = 1},
new Items {shortname = "grenade.beancan", amount = 10},
new Items {shortname = "flamethrower", amount = 1},
};
List<Items> ListpyatsotGribov = new List<Items>
{
new Items {shortname = "ammo.rocket.basic", amount = 5},
new Items {shortname = "ammo.rocket.smoke", amount = 1},
new Items {shortname = "autoturret", amount = 1},
new Items {shortname = "cloth", amount = 2500},
new Items {shortname = "cctv.camera", amount = 1},
new Items {shortname = "charcoal", amount = 10000},
new Items {shortname = "chainsaw", amount = 1},
new Items {shortname = "jackhammer", amount = 1},
new Items {shortname = "door.hinged.toptier", amount = 1},
new Items {shortname = "ladder.wooden.wall", amount = 3},
new Items {shortname = "furnace.large", amount = 1},
new Items {shortname = "mining.quarry", amount = 1},
new Items {shortname = "rifle.ak", amount = 1},
new Items {shortname = "sulfur.ore", amount = 10000},
new Items {shortname = "rifle.lr300", amount = 1},
new Items {shortname = "shotgun.spas12", amount = 1},
new Items {shortname = "explosive.timed", amount = 5},
new Items {shortname = "rocket.launcher", amount = 1},
new Items {shortname = "scrap", amount = 1000},
new Items {shortname = "metal.facemask", amount = 1},
};
List<Items> ListsemsotGribov = new List<Items>
{
new Items {shortname = "metal.facemask", amount = 1},
new Items {shortname = "rocket.launcher", amount = 1},
new Items {shortname = "explosives", amount = 200},
new Items {shortname = "metal.plate.torso", amount = 1},
new Items {shortname = "rifle.l96", amount = 1},
new Items {shortname = "rifle.m39", amount = 1},
new Items {shortname = "rifle.semiauto", amount = 1},
new Items {shortname = "rifle.ak", amount = 1},
new Items {shortname = "rifle.bolt", amount = 1},
new Items {shortname = "pistol.m92", amount = 1},
new Items {shortname = "sulfur.ore", amount = 15000},
new Items {shortname = "scrap", amount = 2500},
new Items {shortname = "cloth", amount = 2500},
new Items {shortname = "charcoal", amount = 30000},
new Items {shortname = "explosives", amount = 200},
new Items {shortname = "supply.signal", amount = 5},
};
List<Items> ListvosemsotGribov = new List<Items>
{
new Items {shortname = "explosive.timed", amount = 10},
new Items {shortname = "ammo.rocket.basic", amount = 10},
new Items {shortname = "multiplegrenadelauncher", amount = 1},
new Items {shortname = "rocket.launcher", amount = 1},
new Items {shortname = "metal.facemask", amount = 1},
new Items {shortname = "metal.plate.torso", amount = 1},
new Items {shortname = "rifle.ak", amount = 1},
new Items {shortname = "rifle.l96", amount = 1},
new Items {shortname = "scrap", amount = 5000},
new Items {shortname = "sulfur.ore", amount = 30000},
new Items {shortname = "cloth", amount = 5000},
new Items {shortname = "explosives", amount = 500},
new Items {shortname = "lmg.m249", amount = 1},
new Items {shortname = "door.hinged.toptier", amount = 1},
new Items {shortname = "door.double.hinged.toptier", amount = 1},
};
#endregion
#region [Крюки / Hooks]
void OnServerInitialized()
{
if (!ImageLibrary)
{
PrintError("Not installed plugin ImageLibrary");
Interface.Oxide.UnloadPlugin(Title);
return;
}
LoadData();
foreach (var player in BasePlayer.activePlayerList)
{
if (!DataBase.StatisticDB.ContainsKey(player.userID))
{
AddPlayer(player);
Puts($"Player add in DataBase {player.displayName}");
}
}
lang.RegisterMessages(Messages, this);
ImageLibrary.Call("AddImage",
"https://pic.moscow.ovh/images/2021/02/06/7520d4c36b762f07a34967fd91673715.png", "firstcase");
ImageLibrary.Call("AddImage",
"https://pic.moscow.ovh/images/2021/02/06/53a47cdf8d093fd098e51cbae2bd0732.png", "secondcase");
ImageLibrary.Call("AddImage",
"https://pic.moscow.ovh/images/2021/02/06/c6a29f5d6f4d883f5c7eb4bef8efa81b.png", "thirdcase");
ImageLibrary.Call("AddImage",
"https://pic.moscow.ovh/images/2021/02/06/aaeeeb059f08dd61fb3b057052f538fe.png", "fourcase");
ImageLibrary.Call("AddImage",
"https://pic.moscow.ovh/images/2021/02/06/445bd482d61eb49010b0a090ab95e87a.png", "fivecase");
ImageLibrary.Call("AddImage",
"https://i.ya-webdesign.com/images/alice-in-wonderland-mushroom-png-3.png", "mushroom");
}
void AddPlayer(BasePlayer player)
{
var data = new StatisticDB
{
Name = player.displayName,
SteamID = player.userID,
Mushrooms = 0
};
DataBase.StatisticDB.Add(player.userID, data);
SaveData();
}
void CheckDataBase(BasePlayer player)
{
if (!DataBase.StatisticDB.ContainsKey(player.userID)) AddPlayer(player);
}
void OnCollectiblePickup(Item item, BasePlayer player)
{
CheckDataBase(player);
switch (item.info.shortname)
{
case "mushroom":
DataBase.StatisticDB[player.userID].Mushrooms += item.amount;
SaveData();
break;
}
}
#endregion
}
}
Держидумаю разбереш как это использоватьC#:using System; using System.Collections.Generic; using System.Linq; using Oxide.Core; using Oxide.Core.Plugins; using Oxide.Game.Rust.Cui; using UnityEngine; using System.Globalization; using Color = UnityEngine.Color; namespace Oxide.Plugins { [Info("Лавка грибника", "Tyger", "10.0.0")] class MushroomPicker : RustPlugin { #region [Вспомогательный код / Helper Code] private static string HexToRustFormat(string hex) { if (string.IsNullOrEmpty(hex)) { hex = "#FFFFFFFF"; } var str = hex.Trim('#'); if (str.Length == 6) str += "FF"; if (str.Length != 8) { throw new Exception(hex); throw new InvalidOperationException("Cannot convert a wrong format."); } var r = byte.Parse(str.Substring(0, 2), NumberStyles.HexNumber); var g = byte.Parse(str.Substring(2, 2), NumberStyles.HexNumber); var b = byte.Parse(str.Substring(4, 2), NumberStyles.HexNumber); var a = byte.Parse(str.Substring(6, 2), NumberStyles.HexNumber); Color color = new Color32(r, g, b, a); return string.Format("{0:F2} {1:F2} {2:F2} {3:F2}", color.r, color.g, color.b, color.a); } #endregion #region [Локализация / Localization] string Message(string key, string playerId = null) => lang.GetMessage(key, this, playerId); private Dictionary<string, string> Messages = new Dictionary<string, string> { ["SUCCESFUL_B"] = "Вы приобрели контейнер.", ["UNSUCCESFUL_B"] = "У вас не хватает грибов на покупку контейнера.", }; #endregion #region [База данных / DataBase] private StoredData DataBase = new StoredData(); class StoredData { public Dictionary<ulong, StatisticDB> StatisticDB = new Dictionary<ulong, StatisticDB>(); } class StatisticDB { public string Name; public ulong SteamID; public int Mushrooms; public StatisticDB() { } } private void SaveData() => Interface.Oxide.DataFileSystem.WriteObject(Name, DataBase); private void LoadData() { try { DataBase = Interface.GetMod().DataFileSystem.ReadObject<StoredData>(Name); } catch (Exception e) { DataBase = new StoredData(); } } #endregion #region [Переменные / Variables] public string Layer = "Box"; public bool AdvertsOn; private string Blur = "assets/content/ui/uibackgroundblur.mat"; #endregion #region [Референсы / References] [PluginReference] Plugin ImageLibrary; private string GetImg(string name) { return (string)ImageLibrary?.Call("GetImage", name) ?? ""; } #endregion #region [Интерфейс / Interface] CuiElementContainer Gui = new CuiElementContainer(); void DrawMushrooms(BasePlayer player) { CuiElementContainer Gui = new CuiElementContainer(); Gui.Add(new CuiPanel { CursorEnabled = true, Image ={Color = HexToRustFormat("#37373733"),Material = Blur}, RectTransform = {AnchorMin = "0 0", AnchorMax = "1 1",} }, "Overlay", Layer); Gui.Add(new CuiButton { Button = {Command = "closegrib",Color = "0 0 0 0"}, Text ={Text = ""}, RectTransform ={AnchorMin = "0 0", AnchorMax = "1 1"} }, Layer, "CloseButton"); Gui.Add(new CuiElement { Name = "Zagolovok", Parent = Layer, Components = { new CuiTextComponent{Text = "Лавка грибника",FontSize = 50,Align = TextAnchor.MiddleCenter,Color = "1 1 1 1"}, new CuiRectTransformComponent{AnchorMin = "0 0.6750006",AnchorMax = "1 0.7675932"}, new CuiOutlineComponent{ Color = HexToRustFormat("#000000B7"),Distance = "0.5 0.5",} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("firstcase")}, new CuiRectTransformComponent{AnchorMin = "0.01041667 0.3703703",AnchorMax = "0.1979167 0.6518519"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("secondcase")}, new CuiRectTransformComponent{AnchorMin = "0.2083333 0.3703703",AnchorMax = "0.3958333 0.6518519"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("thirdcase")}, new CuiRectTransformComponent{AnchorMin = "0.40625 0.3703703",AnchorMax = "0.59375 0.6518519"} } }); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("fourcase")}, new CuiRectTransformComponent { AnchorMin = "0.6041667 0.3703703", AnchorMax = "0.7916667 0.6518519"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiRawImageComponent{Color = "1 1 1 1",Png = GetImg("fivecase")}, new CuiRectTransformComponent {AnchorMin = "0.8020834 0.3703703",AnchorMax = "0.9895834 0.6518519"} }}); Gui.Add(new CuiButton { Button ={Command = $"buyboxes {0}",Color = HexToRustFormat("#2DCE5BFF")}, Text ={Color = "1 1 1 1",Text = "КУПИТЬ",Align = TextAnchor.MiddleCenter,FontSize = 35}, RectTransform ={AnchorMin = "0.01041667 0.3120368",AnchorMax = "0.1979167 0.3657406"} }, Layer, "GribButton"); ; Gui.Add(new CuiButton { Button ={Command = $"buyboxes {1}",Color = HexToRustFormat("#2DCE5BFF")}, Text ={Color = "1 1 1 1",Text = "КУПИТЬ",Align = TextAnchor.MiddleCenter,FontSize = 35}, RectTransform ={AnchorMin = "0.2083333 0.3120368",AnchorMax = "0.3958333 0.3657406"} }, Layer, "GribButton"); Gui.Add(new CuiButton { Button ={Command = $"buyboxes {2}",Color = HexToRustFormat("#2DCE5BFF")}, Text ={Color = "1 1 1 1",Text = "КУПИТЬ",Align = TextAnchor.MiddleCenter,FontSize = 35}, RectTransform = {AnchorMin = "0.40625 0.3120368",AnchorMax = "0.59375 0.3657406"} }, Layer, "GribButton"); Gui.Add(new CuiButton { Button ={Command = $"buyboxes {3}",Color = HexToRustFormat("#2DCE5BFF")}, Text ={ Color = "1 1 1 1", Text = "КУПИТЬ", Align = TextAnchor.MiddleCenter, FontSize = 35}, RectTransform = {AnchorMin = "0.6041667 0.3120368", AnchorMax = "0.7916667 0.3657406"} }, Layer, "GribButton"); Gui.Add(new CuiButton { Button ={Command = $"buyboxes {4}", Color = HexToRustFormat("#2DCE5BFF")}, Text = { Color = "1 1 1 1", Text = "КУПИТЬ", Align = TextAnchor.MiddleCenter, FontSize = 35}, RectTransform ={ AnchorMin = "0.8020834 0.3120368",AnchorMax = "0.9895834 0.3657406"} }, Layer, "GribButton"); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiImageComponent{Color = HexToRustFormat("#3737377A")}, new CuiRectTransformComponent{AnchorMin = "0.8020834 0.1638889",AnchorMax = "0.9895834 0.2972219"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiRawImageComponent{ Color = "1 1 1 1",Png = GetImg("mushroom")}, new CuiRectTransformComponent{AnchorMin = "0.809375 0.16944445",AnchorMax = "0.8895833 0.2898148"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiTextComponent{Text = $"<b>: {DataBase.StatisticDB[player.userID].Mushrooms}</b>", Align = TextAnchor.MiddleCenter, FontSize = 50}, new CuiRectTransformComponent { AnchorMin = "0.895832 0.1694444",AnchorMax = "0.9760403 0.2898148"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components = { new CuiImageComponent{Color = HexToRustFormat("#3737377B"), }, new CuiRectTransformComponent { AnchorMin = "0.01041667 0.1638889", AnchorMax = "0.7921875 0.2972219"} }}); Gui.Add(new CuiElement { Name = "MushroomElem", Parent = Layer, Components ={ new CuiTextComponent{Text = $"<b>Чтобы открыть хотя бы один контейнер, вам требуется собрать определенное количество грибов которое написано на одном из ящиков.</b>", Align = TextAnchor.MiddleCenter,FontSize = 32}, new CuiRectTransformComponent{ AnchorMin = "0.01041667 0.1638889", AnchorMax = "0.7921875 0.2972219" } }}); CuiHelper.AddUi(player, Gui); } #endregion #region [Команда / Commands] [ConsoleCommand("buyboxes")] void buybox(ConsoleSystem.Arg args) { BasePlayer player = args.Player(); int i = int.Parse(args.Args[0]); System.Random rnd = new System.Random(); switch (i) { case 0: if (DataBase.StatisticDB[player.userID].Mushrooms >= 100) { for (int d = 0; d < 7; d++) { var item = ListStoGribov[rnd.Next(ListStoGribov.Count())]; ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain); } DataBase.StatisticDB[player.userID].Mushrooms -= 100; SendReply(player, Message("SUCCESFUL_B")); SaveData(); CuiHelper.DestroyUi(player, Layer); } else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer); break; case 1: if (DataBase.StatisticDB[player.userID].Mushrooms >= 300) { for (int d = 0; d < 6; d++) { var item = ListTristaGribov[rnd.Next(ListTristaGribov.Count())]; ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain); } DataBase.StatisticDB[player.userID].Mushrooms -= 300; SendReply(player, Message("SUCCESFUL_B")); SaveData(); CuiHelper.DestroyUi(player, Layer); } else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer); break; case 2: if (DataBase.StatisticDB[player.userID].Mushrooms >= 500) { for (int d = 0; d < 6; d++) { var item = ListpyatsotGribov[rnd.Next(ListpyatsotGribov.Count())]; ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain); } DataBase.StatisticDB[player.userID].Mushrooms -= 500; SendReply(player, Message("SUCCESFUL_B")); SaveData(); CuiHelper.DestroyUi(player, Layer); } else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer); break; case 3: if (DataBase.StatisticDB[player.userID].Mushrooms >= 700) { for (int d = 0; d < 5; d++) { var item = ListsemsotGribov[rnd.Next(ListsemsotGribov.Count())]; ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain); } DataBase.StatisticDB[player.userID].Mushrooms -= 700; SendReply(player, Message("SUCCESFUL_B")); SaveData(); CuiHelper.DestroyUi(player, Layer); } else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer); break; case 4: if (DataBase.StatisticDB[player.userID].Mushrooms >= 900) { for (int d = 0; d < 5; d++) { var item = ListvosemsotGribov[rnd.Next(ListvosemsotGribov.Count())]; ItemManager.CreateByName(item.shortname, item.amount).MoveToContainer(player.inventory.containerMain); } DataBase.StatisticDB[player.userID].Mushrooms -= 900; SendReply(player, Message("SUCCESFUL_B")); SaveData(); CuiHelper.DestroyUi(player, Layer); } else SendReply(player, Message("UNSUCCESFUL_B")); CuiHelper.DestroyUi(player, Layer); break; } } [ChatCommand("grib")] void gribsettings(BasePlayer player) { if (player == null) DrawMushrooms(player); else DrawMushrooms(player); } [ConsoleCommand("gribs")] void givegribs(ConsoleSystem.Arg args) { BasePlayer player = args.Player(); if (player.IsAdmin) { DataBase.StatisticDB[player.userID].Mushrooms += 500; SaveData(); } else SendReply(player, "no"); } [ConsoleCommand("closegrib")] void closegrib(ConsoleSystem.Arg args) { BasePlayer player = args.Player(); CuiHelper.DestroyUi(player, Layer); } #endregion #region [Предметы / Items] class Items { public string shortname; public int amount; } List<Items> ListStoGribov = new List<Items> { new Items {shortname = "scrap", amount = 500}, new Items {shortname = "workbench1", amount = 1}, new Items {shortname = "riflebody", amount = 5}, new Items {shortname = "pistol.python", amount = 1}, new Items {shortname = "pistol.eoka", amount = 1}, new Items {shortname = "keycard_red", amount = 1}, new Items {shortname = "jackhammer", amount = 1}, new Items {shortname = "crossbow", amount = 1}, new Items {shortname = "box.repair.bench", amount = 1}, new Items {shortname = "ammo.rocket.basic", amount = 1}, new Items {shortname = "coffeecan.helmet", amount = 1}, new Items {shortname = "furnace", amount = 1}, new Items {shortname = "heavy.plate.helmet", amount = 1}, new Items {shortname = "heavy.plate.jacket", amount = 1}, new Items {shortname = "heavy.plate.pants", amount = 1}, new Items {shortname = "pickaxe", amount = 1}, new Items {shortname = "syringe.medical", amount = 1}, new Items {shortname = "weapon.mod.silencer", amount = 1}, new Items {shortname = "xmas.tree", amount = 1}, new Items {shortname = "weapon.mod.muzzlebrakee", amount = 1}, new Items {shortname = "wall.frame.garagedoor", amount = 1}, new Items {shortname = "tool.camera", amount = 1}, new Items {shortname = "trap.landmine", amount = 1}, new Items {shortname = "targeting.computer", amount = 1}, new Items {shortname = "shotgun.waterpipe", amount = 1}, }; List<Items> ListTristaGribov = new List<Items> { new Items {shortname = "workbench2", amount = 1}, new Items {shortname = "smg.mp5", amount = 1}, new Items {shortname = "smgbody", amount = 5}, new Items {shortname = "scrap", amount = 550}, new Items {shortname = "ammo.rocket.basic", amount = 3}, new Items {shortname = "shotgun.double", amount = 1}, new Items {shortname = "shotgun.spas12", amount = 1}, new Items {shortname = "shotgun.pump", amount = 1}, new Items {shortname = "weapon.mod.small.scope", amount = 1}, new Items {shortname = "xmas.present.large", amount = 1}, new Items {shortname = "sulfur.ore", amount = 3000}, new Items {shortname = "rifle.m39", amount = 1}, new Items {shortname = "pistol.m92", amount = 1}, new Items {shortname = "pistol.semiauto", amount = 1}, new Items {shortname = "rifle.semiauto", amount = 1}, new Items {shortname = "jackhammer", amount = 1}, new Items {shortname = "chainsaw", amount = 1}, new Items {shortname = "heavy.plate.jacket", amount = 1}, new Items {shortname = "grenade.beancan", amount = 10}, new Items {shortname = "flamethrower", amount = 1}, }; List<Items> ListpyatsotGribov = new List<Items> { new Items {shortname = "ammo.rocket.basic", amount = 5}, new Items {shortname = "ammo.rocket.smoke", amount = 1}, new Items {shortname = "autoturret", amount = 1}, new Items {shortname = "cloth", amount = 2500}, new Items {shortname = "cctv.camera", amount = 1}, new Items {shortname = "charcoal", amount = 10000}, new Items {shortname = "chainsaw", amount = 1}, new Items {shortname = "jackhammer", amount = 1}, new Items {shortname = "door.hinged.toptier", amount = 1}, new Items {shortname = "ladder.wooden.wall", amount = 3}, new Items {shortname = "furnace.large", amount = 1}, new Items {shortname = "mining.quarry", amount = 1}, new Items {shortname = "rifle.ak", amount = 1}, new Items {shortname = "sulfur.ore", amount = 10000}, new Items {shortname = "rifle.lr300", amount = 1}, new Items {shortname = "shotgun.spas12", amount = 1}, new Items {shortname = "explosive.timed", amount = 5}, new Items {shortname = "rocket.launcher", amount = 1}, new Items {shortname = "scrap", amount = 1000}, new Items {shortname = "metal.facemask", amount = 1}, }; List<Items> ListsemsotGribov = new List<Items> { new Items {shortname = "metal.facemask", amount = 1}, new Items {shortname = "rocket.launcher", amount = 1}, new Items {shortname = "explosives", amount = 200}, new Items {shortname = "metal.plate.torso", amount = 1}, new Items {shortname = "rifle.l96", amount = 1}, new Items {shortname = "rifle.m39", amount = 1}, new Items {shortname = "rifle.semiauto", amount = 1}, new Items {shortname = "rifle.ak", amount = 1}, new Items {shortname = "rifle.bolt", amount = 1}, new Items {shortname = "pistol.m92", amount = 1}, new Items {shortname = "sulfur.ore", amount = 15000}, new Items {shortname = "scrap", amount = 2500}, new Items {shortname = "cloth", amount = 2500}, new Items {shortname = "charcoal", amount = 30000}, new Items {shortname = "explosives", amount = 200}, new Items {shortname = "supply.signal", amount = 5}, }; List<Items> ListvosemsotGribov = new List<Items> { new Items {shortname = "explosive.timed", amount = 10}, new Items {shortname = "ammo.rocket.basic", amount = 10}, new Items {shortname = "multiplegrenadelauncher", amount = 1}, new Items {shortname = "rocket.launcher", amount = 1}, new Items {shortname = "metal.facemask", amount = 1}, new Items {shortname = "metal.plate.torso", amount = 1}, new Items {shortname = "rifle.ak", amount = 1}, new Items {shortname = "rifle.l96", amount = 1}, new Items {shortname = "scrap", amount = 5000}, new Items {shortname = "sulfur.ore", amount = 30000}, new Items {shortname = "cloth", amount = 5000}, new Items {shortname = "explosives", amount = 500}, new Items {shortname = "lmg.m249", amount = 1}, new Items {shortname = "door.hinged.toptier", amount = 1}, new Items {shortname = "door.double.hinged.toptier", amount = 1}, }; #endregion #region [Крюки / Hooks] void OnServerInitialized() { if (!ImageLibrary) { PrintError("Not installed plugin ImageLibrary"); Interface.Oxide.UnloadPlugin(Title); return; } LoadData(); foreach (var player in BasePlayer.activePlayerList) { if (!DataBase.StatisticDB.ContainsKey(player.userID)) { AddPlayer(player); Puts($"Player add in DataBase {player.displayName}"); } } lang.RegisterMessages(Messages, this); ImageLibrary.Call("AddImage", "https://pic.moscow.ovh/images/2021/02/06/7520d4c36b762f07a34967fd91673715.png", "firstcase"); ImageLibrary.Call("AddImage", "https://pic.moscow.ovh/images/2021/02/06/53a47cdf8d093fd098e51cbae2bd0732.png", "secondcase"); ImageLibrary.Call("AddImage", "https://pic.moscow.ovh/images/2021/02/06/c6a29f5d6f4d883f5c7eb4bef8efa81b.png", "thirdcase"); ImageLibrary.Call("AddImage", "https://pic.moscow.ovh/images/2021/02/06/aaeeeb059f08dd61fb3b057052f538fe.png", "fourcase"); ImageLibrary.Call("AddImage", "https://pic.moscow.ovh/images/2021/02/06/445bd482d61eb49010b0a090ab95e87a.png", "fivecase"); ImageLibrary.Call("AddImage", "https://i.ya-webdesign.com/images/alice-in-wonderland-mushroom-png-3.png", "mushroom"); } void AddPlayer(BasePlayer player) { var data = new StatisticDB { Name = player.displayName, SteamID = player.userID, Mushrooms = 0 }; DataBase.StatisticDB.Add(player.userID, data); SaveData(); } void CheckDataBase(BasePlayer player) { if (!DataBase.StatisticDB.ContainsKey(player.userID)) AddPlayer(player); } void OnCollectiblePickup(Item item, BasePlayer player) { CheckDataBase(player); switch (item.info.shortname) { case "mushroom": DataBase.StatisticDB[player.userID].Mushrooms += item.amount; SaveData(); break; } } #endregion } }
Пы.Сы.
может есть у кого CobaltLaboratory :Пожалуйста, авторизуйтесь для просмотра ссылки.
зачем этот плагин ели есть копипаста!?!??! там все те же настройки да и он бесплатный а этот с лабой просто спижжен с копипасты и стоит касарь ало!ДержиПожалуйста, авторизуйтесь для просмотра ссылки.
Улител в бан. Тыкальщик )ДержиПожалуйста, авторизуйтесь для просмотра ссылки.
А ЕСТЬ ПОСТРОЙКА?ДержиПожалуйста, авторизуйтесь для просмотра ссылки.
есть лучшеЕсть у кого-то iqreportsystem с панелькой модератора?
а этого нету у тебя?есть лучшеПожалуйста, авторизуйтесь для просмотра ссылки.
Нету, к сожелениюа этого нету у тебя?Пожалуйста, авторизуйтесь для просмотра ссылки.
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz