So a few things.
Lang:CS
For a GUI
How can I force one upon a player
EXAMPLE:
/GUI Player Message
And 1 more thing.
How would I change the position of the GUI on a screen
So I could have it on the top right persay
(I might have to add more to this later)
GUI Stuff
Discussion in 'Rust Discussion' started by DylanSMR, Aug 6, 2015.
-
Wulf Community Admin
I'd recommend looking at some if the existing GUI plugins, as well as the thread listed below.
http://oxidemod.org/threads/community-entity-ui.9151/ -
One more thing I didnt see, how do people align the xmax, xmin, ymax, ymin so perfectly?
-
-
Anything look wrong in the code below?
Code:using UnityEngine; using Rust; using Oxide.Core.Plugins;namespace Oxide.Plugins { [Info("PmGui", "DylanSMR", "0.0.1", ResourceId = 8902)] class PmGui : RustPlugin { int PmDisappearTime = 15; //15 Seconds System.Timers.Timer timer; bool canRun = true; #region JSON string json = @"[ { ""name"": ""PmGui"", ""parent"": ""Overlay"", ""components"": [ { ""type"":""UnityEngine.UI.Image"", ""color"":""0.1 0.1 0.1 0.7"", }, { ""type"":""RectTransform"", ""anchormin"": ""1 0.89"", ""anchormax"": ""0.86 1"" } ] }, { ""parent"": ""PmGui"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""From: {from}"", ""fontSize"":10, ""align"": ""MiddleCenter"", }, { ""type"":""RectTransform"", ""anchormin"": ""0.92 0.90"", ""anchormax"": ""0.87 0.93"" } ] }, { ""parent"": ""PmGui"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""{msg}"", ""fontSize"":15, ""align"": ""MiddleCenter"", }, { ""type"":""RectTransform"", ""anchormin"": ""0.87 0.85"", ""anchormax"": ""0.87 0.93"" } ] } { ""parent"": ""PmGui"", ""components"": [ { ""type"":""UnityEngine.UI.Text"", ""text"":""New Message:"", "'fontSize"":18, ""align"": ""MiddleCenter"", }, { ""type"":""RectTransform"", ""anchormin"": ""0.98 0.97"", ""anchormax"": ""0.87 0.93"" } ] } ] "; #endregion void LoadMsgGui(string Name, string Msg) { string send = json.Replace("{from}", Name).Replace("{msg}", Msg); foreach (BasePlayer player in BasePlayer.activePlayerList) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", send); } timer.Start(); } void Loaded() { timer = new System.Timers.Timer(1000 * PmDisappearTime); timer.Interval = 1000 * PmDisappearTime; timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); } void Unload() { timer.Stop(); } BasePlayer TempPlayer; [ChatCommand("pm")] void cmdAnnounceTo(BasePlayer player, string command, string[] args) { if(!canRun) { SendReply(player, "You have messages this person recently please wait " + PmDisappearTime + " seconds."); return; } if(args.Length >= 2) { string Player = args[0].ToLower(), Msg = ""; for(int i = 1; i < args.Length; i++) Msg = Msg + " " + args[i]; BasePlayer p; if((p = BasePlayer.activePlayerList.Find(x => x.displayName.ToLower().EndsWith(Player))) != null) //used ends with due to clan tags { string send = json.Replace("{from}", player.displayName).Replace("{msg}", Msg); CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = p.net.connection }, null, "AddUI", send); canRun = false; timer.Start(); TempPlayer = p; } else SendReply(player, Player+" is not online."); } else SendReply(player, "Incorrect Syntax use /pm <name> <msg>"); } } }
Last edited by a moderator: Aug 7, 2015