Regarding bigger mapsBigger maps may have less accurate readings with the map grid option, working on a fix but please use the old display instead.
- In-Game / Server Time.
- Online Player counter
- Sleeper Counter
- Message box
- Airdrop alert
- Helicopter alert
- Radiation alert
- Coordinates
- Full Customization
- Custom Panels: Simple text and Icon
- Api
- /ipanel - Show the available commands
- /ipanel hide - Hide the Info Panel
- /ipanel show - Show the Info Panel
- /ipanel clock game - The clock will show the in-game time.
- /ipanel clock server < /-hours> - The clock will show the RL time. You can add or remove hours.
- /ipanel timeformat - Show the available time formats.
- /ipanel timeformat - Select your favorite time format from the list.
The settings and options can be configured in the file under the directory. The use of an editor and validator is recommended to avoid formatting issues and syntax errors. InfoPanelconfig
- Available: (Default: true), With this option u can turn on or off a panel.
- Dock: (Default: BottomPanel) , With this option u can choose the dock panel.
- Order: With this option u can set the order of the panels. (Panels with the same dock and AnchorX)
- AnchorX: (Default: Left), You can pull the panel to the left or right side of the dock. (Left/Right)
- **AnchorY: **(Default: Bottom), You can pull the panel to the top or bottom of the dock/screen. (Top/Bottom)
- Width: Panel width. (0-1)
- Height: Panel height. (0-1)
- Margin: (Default: 0 0 0 0.005) Panel margin (Top,Right,Bottom,Left)
- Autoload: (Default: true) If u turn this off (false). The panel not will be displayed automatically. But other plugins can trigger it.
- CoordType (Default: 2) From 0-2 will display coordinates in a different format. E.X "0" - X: 1000 | Z: 1000, "1" D12 "2" combination of both
配置如下
using System;
using System.Collections.Generic;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("ApiTest", "Ghosst", "1.0.0")]
[Description("OnlinePlayers Counter.")]
public class ApiTest : RustPlugin
{
Timer CounterTimer;
Timer BlinkTimer;
Timer RandPTimer;
int Count = 0;
bool IsActive = true;
string RandomPlayerID;
bool RandomPlayername = false;
bool Blinker = false;
bool CounterP = false;
List<string> Panels = new List<string> { "BlinkPanel", "CounterPanel", "RandomPlayernamePanel" };
[PluginReference]
Plugin InfoPanel;
void Loaded()
{
if(InfoPanel)
{
InfoPanelInit();
}
}
void OnPluginLoaded(Plugin InfoPanel)
{
if (InfoPanel.Title == "InfoPanel")
{
InfoPanelInit();
}
}
public void InfoPanelInit()
{
//Send Panel names to the infopanel.
InfoPanel.Call("SendPanelInfo", "ApiTest", Panels);
AddRandomPlayerNamePanel();
AddBlinkPanel();
AddCounterPanel();
if (CounterTimer == null & CounterP)
{
CounterTimer = timer.Repeat(5, 0, () => Counter());
}
if (BlinkTimer == null & Blinker)
{
BlinkTimer = timer.Repeat(5, 0, () => Blink());
}
if (RandPTimer == null & RandomPlayername)
{
RandPTimer = timer.Repeat(5, 0, () => RandomPlayer());
}
}
/// <summary>
/// Load the panel
/// </summary>
public void AddRandomPlayerNamePanel()
{
RandomPlayername = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "RandomPlayernamePanel", RndPlayerNameCfg);
}
/// <summary>
/// Load the panel.
/// Show the panel everyone.
/// </summary>
public void AddBlinkPanel()
{
Blinker = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "BlinkPanel", BlinkPCfg);
InfoPanel.Call("ShowPanel", "ApiTest", "BlinkPanel");
}
/// <summary>
/// Load the panel.
/// Show the panel everyone.
/// </summary>
public void AddCounterPanel()
{
CounterP = (bool)InfoPanel.Call("PanelRegister", "ApiTest", "CounterPanel", CounterPCfg);
InfoPanel.Call("ShowPanel", "ApiTest", "CounterPanel");
}
/// <summary>
/// Hide or show the panel
/// </summary>
public void Blink()
{
if(IsActive)
{
IsActive = false;
InfoPanel.Call("HidePanel", "ApiTest", "BlinkPanel");
}
else
{
IsActive = true;
InfoPanel.Call("ShowPanel", "ApiTest", "BlinkPanel");
}
}
/// <summary>
/// Refresh the counter to every active player.
/// </summary>
public void Counter()
{
Count = 5;
if (InfoPanel && CounterP)
{
InfoPanel.Call("SetPanelAttribute", "ApiTest", "CounterPanelText", "Content", Count.ToString());
InfoPanel.Call("SetPanelAttribute", "ApiTest", "CounterPanelText", "FontColor", "0.6 0.1 0.1 1");
InfoPanel.Call("RefreshPanel", "ApiTest", "CounterPanel");
}
}
/// <summary>
/// Show his name to a random player. But just only for him.
/// </summary>
public void RandomPlayer()
{
if(RandomPlayerID != null)
InfoPanel.Call("HidePanel", "ApiTest", "RandomPlayernamePanel", RandomPlayerID);
if(BasePlayer.activePlayerList.Count > 0)
{
var rand = new System.Random();
BasePlayer player = BasePlayer.activePlayerList[rand.Next(BasePlayer.activePlayerList.Count)];
RandomPlayerID = player.UserIDString;
if (InfoPanel && RandomPlayername)
{
InfoPanel.Call("SetPanelAttribute", "ApiTest", "RandomPlayernamePanelText", "Content", player.displayName, RandomPlayerID);
InfoPanel.Call("SetPanelAttribute", "ApiTest", "RandomPlayernamePanelText", "FontColor", "0.2 0.3 0.5 1", RandomPlayerID);
InfoPanel.Call("ShowPanel", "ApiTest", "RandomPlayernamePanel", RandomPlayerID);
}
}
}
/*
Example Configs. Theres is no required option.
*/
string RndPlayerNameCfg = @"
{
""Autoload"": false,
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.4"",
""Dock"": ""BottomPanel"",
""Width"": 0.07,
""Height"": 0.95,
""Margin"": ""0 0 0 0.005"",
""Order"": 0,
""Image"": {
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.3"",
""Dock"": ""BottomPanel"",
""Height"": 0.8,
""Margin"": ""0 0.05 0.1 0.05"",
""Order"": 1,
""Url"": ""
"",
""Width"": 0.22
},
""Text"": {
""Align"": ""MiddleCenter"",
""AnchorX"": ""Left"",
""AnchorY"": ""Bottom"",
""Available"": true,
""BackgroundColor"": ""0.1 0.1 0.1 0.3"",
""Dock"": ""BottomPanel"",
""FontColor"": ""1 1 1 1"",
""FontSize"": 14,
""Content"": ""APITest Bottom"",
""Height"": 1.0,
""Margin"": ""0 0 0 0"",
""Order"": 2,
""Width"": 0.63
},
}";
string BlinkPCfg = @"{}";
string CounterPCfg = @"
{
""Dock"": ""TopPanel"",
""Text"": {
""Content"": ""APITest Top""
}
}";
}
}
|