GUI in Lua

Discussion in 'Rust Development' started by LaserHydra, Jul 29, 2015.

  1. I've tried to implement GUI to my Admin Tickets plugin, which is still in Lua.
    I've tried the following:
    Code:
     json ="[\"\"name\"\": \"\"TicketGUI\"\",\"\"parent\"\": \"\"Overlay\"\",\"\"components\"\":[{\"\"type\"\":\"\"UnityEngine.UI.Text\"\",\"\"text\"\":\"\"{text}\"\",\"\"fontSize\"\":20,\"\"align\"\": \"\"MiddleCenter\"\",},{\"\"type\"\":\"\"RectTransform\"\",\"\"anchormin\"\": \"\"0 0.20\"\",\"\"anchormax\"\": \"\"1 0.9\"\"}]}]"
        text ="There currently are <color=aqua>"..#TicketsData.Tickets .."</color> active tickets!"
       local players = global.BasePlayer.activePlayerList:GetEnumerator()
       while players:MoveNext()do
           local currId = rust.UserIDFromPlayer(players.Current)
           if permission.UserHasPermission(currId,"isTicketsAdmin")then
                CommunityEntity.ServerInstance:ClientRPCEx( Network:SendInfo(){ connection = players.Current.net.connection },nil,"AddUI",string.gsub(json,"{text}", text));
           end
       end