PaiN submitted a new resource:
Motd GUI - Simple Motd on the screen.
Read more about this resource...

Motd GUI
Shows a simple MOTD on the screen
Total Downloads: 1,587 - First Release: Jul 18, 2015 - Last Update: Apr 2, 2016
- 5/5, 5 likes
-
add a timer to it man, and can you position it to be in the middle top of the screen?
-
-
-
Its possible .. but thats why i added /motd command..
-
I like this idea! Is there a way to make it bigger and center the window? I created an image I want to show to people but it's too small to read the text
-
Start with changing the a bit to learn how they work and then make the thing that you want. -
I don't know C#, please check my code
Code:// void Loaded() timer.Once(30, () => CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "DestroyUI", "Motd"));// other void OnPlayerSleepEnded(BasePlayer player) { string text = Config["Motd", "Message"].ToString(); string title = Config["Motd", "Title"].ToString(); CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", json.Replace("{text}", text).Replace("{title}", title)); timer.Once(30, () => CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "DestroyUI", "Motd")); }
-
-
Oh my god, i get error
Code:[Error] Failed to run a 30.00 timer in MotdGUI (NullReferenceException: Object reference not set to an instance of an object) [Debug] at Oxide.Plugins.MotdGUI+<OnPlayerSleepEnded>c__AnonStorey1.<>m__0 () [0x00000] in <filename unknown>:0
-
Dont know C#, Google will have to be my friend on this one
-
-
I managed to center the image and make it look "okay"
http://www.gameofstones.eu/ingame/screenshot.png
(sorry for the weird quality, running it in windowed mode to do the testing)
Just need to find out how to auto close the window after x seconds and we're good to go! -
Hello, how can I move the MOTD???
Please help -
This is the edited code that shows the image like it does in my screenshot. You can replace it with the code in your MotdGUI.cs file.
Change the image URL by your own URL. Make the imagesize approx 1111x679 .
Sorry for the weird resolution, I'll have to do some more tests to make it appear in better quality.
Code:using UnityEngine; using Rust; using Oxide.Core.Plugins;namespace Oxide.Plugins { [Info("Motd GUI", "PaiN", 0.1, ResourceId = 0)] [Description("Simple Motd on the screen.")] public class MotdGUI : RustPlugin { System.Collections.Generic.List<ulong> guioff = new System.Collections.Generic.List<ulong>(); void Loaded() { LoadDefaultConfig(); foreach(BasePlayer player in BasePlayer.activePlayerList) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", json); } } protected override void LoadDefaultConfig() { SaveConfig(); } #region JSON string json = @"[ { ""name"": ""Motd"", ""parent"": ""Overlay"", ""components"": [ { ""type"":""UnityEngine.UI.RawImage"", ""imagetype"": ""Tiled"", ""color"": ""1.0 1.0 1.0 1.0"", ""url"": ""http://www.gameofstones.eu/ingame/motd11.png"", }, { ""type"":""RectTransform"", ""anchormin"": ""0.19 0.19"", ""anchormax"": ""0.8 0.8"", ""align"": ""MiddleCenter"", } ] } ] "; #endregion [ChatCommand("motd")] void cmdMotdShow(BasePlayer player, string cmd, string[] args) { if(guioff.Contains(player.userID)) { string text = Config["Motd", "Message"].ToString(); string title = Config["Motd", "Title"].ToString(); CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", json); guioff.Remove(player.userID); } else { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "DestroyUI", "Motd"); guioff.Add(player.userID); } } [HookMethod("OnPlayerInit")] void OnPlayerInit(BasePlayer player) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", json); } void Unloaded(BasePlayer player) { foreach (BasePlayer current in BasePlayer.activePlayerList) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = current.net.connection }, null, "DestroyUI", "Motd"); } } void OnPlayerDisconnected(BasePlayer player) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "DestroyUI", "Motd"); } } }
-
NO!
I want move my MOTD screen!!!
HOW I CAN MAKE IT!! -
Maybe do some testing by changing the anchormin anchormax values.
And there's no need for those screaming caps. -
WRITE this???
Code:#region JSON string json = @"[ { ""name"": ""Motd"", ""parent"": ""Overlay"", ""components"": [ { ""type"":""UnityEngine.UI.Image"", ""color"":""0.1 0.1 0.1 0.7"", }, { ""type"":""RectTransform"", ""anchormin"": ""0.001 0.65"", ""anchormax"": ""0.25 0.85"" } ] }, { ""parent"": ""Motd"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""{title}"", ""fontSize"":20, ""align"": ""MiddleCenter"", }, { ""type"":""RectTransform"", ""anchormin"": ""0 0.7"", ""anchormax"": ""1 1"" } ] }, { ""parent"": ""Motd"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""{text}"", ""fontSize"":15, ""align"": ""MiddleCenter"", }, { ""type"":""RectTransform"", ""anchormin"": ""0 0.1"", ""anchormax"": ""1 1.2"" } ] } ] "; #endregion
Last edited by a moderator: Jul 20, 2015 -
[DOUBLEPOST=1437399301][/DOUBLEPOST]For those who are interested, this is the modified version I run on my server (screenshot: http://www.gameofstones.eu/ingame/screenshot.png):
It displays the image for 30 seconds, then the image disappears.
To adjust the image location:
- Change the URL in line 43
To adjust the timer:
- Change the timervalue (currently 30f) to anything you like (20 seconds will be 20f, etc...) on line 20, 64 and 79
This version still makes a config file but it's empty since no text is used.
You will have to "play" with the image sizes, I'm still looking for the perfect size (size in the screenshot is 1111x679)Attached Files:
-
-