1. I'm going to edit this as I move forward, pay attention to the TODOS because they mean you'll have to edit values inside the method.
    ps: Loler Thread History :D

    Importing the Plugin into yours
    Code:
    var JsCuiHelper = plugins.Find("JsCuiHelper");
    var _JsCuiHelper = JsCuiHelper.CallHook('JsUi');
    // use _JsCuiHelper methods
    
    Code:
    var _JsCuiHelper = new Object();
    var CUI, container;/**
    *
    * @param name {String} name of the window  default "jscuihelper.main"
    * @param cursor {Boolean} should it use cursor? default true
    * @param color {String}  default "1 1 1 0.5"
    * @param parent {String} name of the parent  default "HUD/Overlay"
    */
    _JsCuiHelper.mainPanel = function(name, cursor, color, parent) {
       var panel;
       container = new CUI.CuiElementContainer;
       panel = new CUI.CuiPanel;   if (!parent) parent = "HUD/Overlay";
       if (!name) name = "jscuihelper.main";
       if (!color) color = "1 1 1 0.5";
       if (!cursor) cursor = true;   panel.CursorEnabled = cursor;
       panel.Image.Color = color;
       container.Add(panel, parent, name);
    };/**
    * Create a close button todo: make Anchors in Arguments
    * @param command {String}  default "jscuihelper.close"
    * @param parent {String}  default "jscuihelper.main"
    * @param text {String}  default "Close"
    * @param fontSize {String} default "14"
    * @method
    */
    _JsCuiHelper.CloseButton = function(command, parent, text, fontSize) {
       var button = new CUI.CuiButton;   if (!parent) parent = "jscuihelper.main";
       if (!text) text = "Close";
       if (!fontSize) fontSize = "14";
       if (!command) command = "jscuihelper.close";   button.RectTransform.AnchorMin = "0 0";
       button.RectTransform.AnchorMax = "0.05 0.05";   button.RectTransform.OffsetMin = "1 1";
       button.RectTransform.offsetmax = "1 1";   button.Button.Command = command;
       button.Button.Close = false;
       button.Button.Color = "0.50 0.50 0.50 1";   button.Text.text = text;
       button.Text.fontSize = fontSize;
       container.Add(button, parent);
    };/**
    * Creates a Header with text todo: makes this actually work
    * @param parent {String}  default: "jscuihelper.main"
    * @method
    */
    _JsCuiHelper.Header = function(parent) {
       if (!parent) parent = "jscuihelper.main";
       var text = new CUI.CuiLabel;
       text.Text.text = "JsCuiHelper";
       text.Text.fontSize = "19";
       text.RectTransform.AnchorMin = "0.5 0.5";
       text.RectTransform.AnchorMax = "0.5 0.5";
       text.RectTransform.Pos = "23 178";
       container.Add(text, parent);
    };/**
    * Alias for CuiHelper.AddUi();
    * @param player {Object} BasePlayer player
    * @method
    */
    _JsCuiHelper.Show = function(player) {
       CUI.CuiHelper.AddUi(player, container);
    };/**
    * Alias for CuiHelper.DestroyUi();
    * @param player {Object} BasePlayer player
    * @method
    */
    _JsCuiHelper.Close = function(player, windowName) {
       CUI.CuiHelper.DestroyUi(player, windowName);
    };var JsCuiHelper = {
       Title: "JsCuiHelper",
       Description: "Helps other JavaScript plugins making windows and stuff",
       Author: "[email protected]",
       Version: V(0, 0, 5),
       ResourceId: 714,
       Init: function() {
         CUI = importNamespace("Oxide.Game.Rust.Cui");
         command.AddConsoleCommand('jsuihelper.close', this.Plugin, 'forceClose');
       },
       forceClose: function(args) {
         CUI.CuiHelper.DestroyUi(args.connection.player, args.GetString(0) || "jscuihelper.main");
       },
       JsUi: function() {
         return _JsCuiHelper;
       }
    };
    
     
    Last edited by a moderator: Nov 28, 2015