Error while compiling OnScreenLogo: No overload for method 'Store' takes 3 arguments | Line: 119, Pos: 48 (Rust NOVEMBER UPDATE)
Error while compiling ...
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using System;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("OnScreenLogo", "Vlad-00003", "1.2.0", ResourceId = 2601)]
[Description("Displays the button on the player screen.")]
//Author info:
//E-mail: [email protected]
//Vk: vk.com/vlad_00003
class OnScreenLogo : RustPlugin
{
private string PanelName = "GsAdX1wazasdsHs";
#region Config Setup
private string Amax = "0.34 0.105";
private string Amin = "0.26 0.025";
private string ImageAddress = "https://fedoraproject.org/w/uploads/e/ee/Edition-server-full_one-color_black.png";
#endregion
#region Initialization
protected override void LoadDefaultConfig()
{
PrintWarning("Generating default configuration file...");
}
protected override void LoadConfig()
{
base.LoadConfig();
GetConfig("Image. Direct link (http/https)", ref ImageAddress);
GetConfig("Minimum anchor", ref Amin);
GetConfig("Maximum anchor", ref Amax);
permission.RegisterPermission("OnScreenLogo.refresh", this);
if (!ImageAddress.ToLower().Contains("http"))
PrintWarning("Now the plugin supports only direct http/https links. Local files are not used - replace the link in the config.");
SaveConfig();
}
void OnServerInitialized()
{
foreach (BasePlayer player in BasePlayer.activePlayerList)
{
CreateButton(player);
}
}
void Unload()
{
foreach (var player in BasePlayer.activePlayerList)
{
CuiHelper.DestroyUi(player, PanelName);
}
}
#endregion
#region Refresh
[ConsoleCommand("osl.refresh")]
private void cmdRefresh(ConsoleSystem.Arg arg)
{
if (arg.Connection != null && arg.Connection.player != null)
{
BasePlayer player = arg.Connection.player as BasePlayer;
if (!permission.UserHasPermission(player.UserIDString, "OnScreenLogo.refresh"))
return;
}
foreach (BasePlayer player in BasePlayer.activePlayerList)
{
CreateButton(player);
}
}
#endregion
#region UI
void OnPlayerSleepEnded(BasePlayer player) => CreateButton(player);
private void CreateButton(BasePlayer player)
{
CuiHelper.DestroyUi(player, PanelName);
CuiElementContainer elements = new CuiElementContainer();
var panel = elements.Add(new CuiPanel
{
Image = {
Color = "0.00 0.00 0.00 0.00"
},
RectTransform = {
AnchorMin = Amin,
AnchorMax = Amax
},
CursorEnabled = false
}, "Overlay", PanelName);
elements.Add(new CuiElement
{
Parent = PanelName,
Components =
{
new CuiRawImageComponent
{
Url = ImageAddress,
Sprite = "assets/content/textures/generic/fulltransparent.tga"
},
new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax = "1 1" }
}
});
CuiHelper.AddUi(player, elements);
}
#endregion
#region Helpers
private void GetConfig<T>(string Key, ref T var)
{
if (Config[Key] != null)
{
var = (T)Convert.ChangeType(Config[Key], typeof(T));
}
Config[Key] = var;
}
#endregion
}
}Merged post
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using System;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("OnScreenLogo", "Vlad-00003", "1.2.1", ResourceId = 2601)]
[Description("Displays the button on the player screen.")]
//Author info:
//E-mail: [email protected]
//Vk: vk.com/vlad_00003
class OnScreenLogo : RustPlugin
{
private string PanelName = "GsAdX1wazasdsHs";
#region Config Setup
private string Amax = "0.34 0.105";
private string Amin = "0.26 0.025";
private string ImageAddress = "https://fedoraproject.org/w/uploads/e/ee/Edition-server-full_one-color_black.png";
private static readonly string[] ImageKeys =
{
"Image. Direct link (http/https)",
"Image. Link or name of the file in the data folder" // старый ключ, оставлен для совместимости
};
#endregion
#region Initialization
protected override void LoadDefaultConfig()
{
PrintWarning("Generating default configuration file...");
}
protected override void LoadConfig()
{
base.LoadConfig();
GetConfig(ImageKeys, ref ImageAddress);
GetConfig("Minimum anchor", ref Amin);
GetConfig("Maximum anchor", ref Amax);
permission.RegisterPermission("OnScreenLogo.refresh", this);
// Убираем старый префикс file:// — локальные файлы больше не поддерживаются
if (ImageAddress != null && ImageAddress.ToLower().StartsWith("file://"))
{
PrintWarning("Local file path is not supported anymore. Please set a direct http/https link in the config.");
ImageAddress = "";
}
if (string.IsNullOrEmpty(ImageAddress) || !ImageAddress.ToLower().Contains("http"))
{
PrintWarning("No valid image URL in config. Using default image. Set 'Image. Direct link (http/https)' to your own link.");
ImageAddress = "https://fedoraproject.org/w/uploads/e/ee/Edition-server-full_one-color_black.png";
}
// Удаляем устаревший ключ из конфига, чтобы не путаться
Config.Remove(ImageKeys[1]);
SaveConfig();
}
void OnServerInitialized()
{
foreach (BasePlayer player in BasePlayer.activePlayerList)
{
CreateButton(player);
}
}
void Unload()
{
foreach (var player in BasePlayer.activePlayerList)
{
CuiHelper.DestroyUi(player, PanelName);
}
}
#endregion
#region Refresh
[ConsoleCommand("osl.refresh")]
private void cmdRefresh(ConsoleSystem.Arg arg)
{
if (arg.Connection != null && arg.Connection.player != null)
{
BasePlayer player = arg.Connection.player as BasePlayer;
if (!permission.UserHasPermission(player.UserIDString, "OnScreenLogo.refresh"))
return;
}
foreach (BasePlayer player in BasePlayer.activePlayerList)
{
CreateButton(player);
}
}
#endregion
#region UI
void OnPlayerSleepEnded(BasePlayer player) => CreateButton(player);
private void CreateButton(BasePlayer player)
{
CuiHelper.DestroyUi(player, PanelName);
CuiElementContainer elements = new CuiElementContainer();
var panel = elements.Add(new CuiPanel
{
Image = {
Color = "0.00 0.00 0.00 0.00"
},
RectTransform = {
AnchorMin = Amin,
AnchorMax = Amax
},
CursorEnabled = false
}, "Overlay", PanelName);
elements.Add(new CuiElement
{
Parent = PanelName,
Components =
{
new CuiRawImageComponent
{
Url = ImageAddress,
Sprite = "assets/content/textures/generic/fulltransparent.tga"
},
new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax = "1 1" }
}
});
CuiHelper.AddUi(player, elements);
}
#endregion
#region Helpers
private void GetConfig(string[] keys, ref string var)
{
foreach (var key in keys)
{
var val = Config[key] as string;
if (!string.IsNullOrEmpty(val))
{
var = val;
break;
}
}
Config[keys[0]] = var;
}
private void GetConfig(string Key, ref string var)
{
GetConfig(new[] { Key }, ref var);
}
#endregion
}
}