My addon has a command, i.e. !open_textbox, that will open a textbox for the client and display some text. The problem is that it will only display the text if the client has the file locally. But I want it to be like the !motd command, so the text displayed in the (motd) box is obtained from the server (the ulx_motd.txt file on the server).
I looked in the "menus.lua" file found in "addons\ulx\lua\ulx\modules\sh" and the "motdmenu.lua" file found in "addons\ulx\lua\ulx\modules\cl" for reference but didn't have much luck.
I understand that the ulx addon is much more complicated than what I'm trying to do, but I hope there's some simple LUA code that can accomplish this as I don't know much about LUA.
My addon's "open_textbox.lua" file is in autorun/client and contains these lines:
...
text:SetTextColor(Color(255, 255, 255))
text:SetDisabled(true)
text:SetMultiline(true)
text:SetVerticalScrollbarEnabled(true)
text:SetText(file.Read("textbox_contents.txt", "GAME"))
end)
The key here being the "SetText" line, this only reads the text in "textbox_contents.txt" if the client has that file. How can I make it read the server's custom text like in the !motd command?