Nbane Posted October 14, 2017 Share Posted October 14, 2017 (edited) I've written some (non-functional) code that i'm currently getting a run time error on. The code should display a window, and inside it is the text for my favourite server's rules. It runs on the event OnGameStart, so it will pop up every time the player first joins a server. Nobody should have an excuse for not knowing the rules, and certainly not reading them with this nifty UI. Shame it doesn't work. I'll keep working on it, if anyone out there spots any glaring errors, let me know. require 'ui/uiHelpers' ------------------------------------------------------------------------ -- Creating a window with some text in it ------------------------------------------------------------------------ clickCounter = 0; -- UI objects mywindow = { x = 500, y = 500, width = 300, height = 300, hasClose = true; }; mygenericelement = { x=550, y=550, width=320, height=320, render = function(element) element:DrawTextCentre("Test Test Test Test Test Test", 150, 100, 1, 0, 0, 1); end; } function DisplayServerRules() LuaUI.createWindow(mywindow); element = LuaUI.createElement(mygenericelement); end Events.OnGameStart.Add(DisplayServerRules()); Edited October 14, 2017 by Nbane Link to comment Share on other sites More sharing options...
Dr_Cox1911 Posted October 14, 2017 Share Posted October 14, 2017 Hi Nbane, all the code you wrote isn't Lua code PZ will recognize. If you want to create a window you have to use the PZ-way for doing so. Look at "media/lua/client/ISUI" for all the windows PZ is using and take a look at some of them. You can instantiate a new window with e.g. ISWindow.lua. Link to comment Share on other sites More sharing options...
Larnest Posted October 15, 2017 Share Posted October 15, 2017 (edited) Why dont you want to use ServerWelcomeMessage to show rules of your server, write down your rules and everytime someone enters your server they will see it? if you only want 14 hours ago, Nbane said: It runs on the event OnGameStart, so it will pop up every time the player first joins a server. Nobody should have an excuse for not knowing the rules, and certainly not reading them with this nifty UI. Edited October 15, 2017 by Larnest Link to comment Share on other sites More sharing options...
Paul Redeker Posted October 19, 2017 Share Posted October 19, 2017 On 10/15/2017 at 12:01 AM, Larnest said: Why dont you want to use ServerWelcomeMessage to show rules of your server, write down your rules and everytime someone enters your server they will see it? if you only want Nobody reads that Link to comment Share on other sites More sharing options...
Larnest Posted October 20, 2017 Share Posted October 20, 2017 9 hours ago, Paul Redeker said: Nobody reads that then nobody will look for some pop-up screen, everyone will close it as soon as it will show up and will never ask what was inside it, but ServerWelcomeMessage will always will be visible in chat Link to comment Share on other sites More sharing options...
Paul Redeker Posted October 20, 2017 Share Posted October 20, 2017 13 hours ago, Larnest said: then nobody will look for some pop-up screen, everyone will close it as soon as it will show up and will never ask what was inside it, but ServerWelcomeMessage will always will be visible in chat Disagree. A large pop up that covers the majority of the screen and has to be closed will be read. And the excuse of "I didn't see it" is also taken away. Link to comment Share on other sites More sharing options...
Larnest Posted October 21, 2017 Share Posted October 21, 2017 19 hours ago, Paul Redeker said: Disagree. A large pop up that covers the majority of the screen and has to be closed will be read. And the excuse of "I didn't see it" is also taken away. ok, you close this pop-up then you are in situation that you need to check the rules, and you cant find them, because pop-up screen is closed, best you will have to disconnect form server enter server and then read the rules, but if it will be in ServerWelcomeMessage then you will have to only open chat window and thats all Link to comment Share on other sites More sharing options...
Nbane Posted October 22, 2017 Author Share Posted October 22, 2017 I failed to create even the most basic UI. The code has no comments. The boiler code is completely commentless. I couldn't get through it at all. I was looking in the right place but it was just too much without remarks/comments humanising the java. Link to comment Share on other sites More sharing options...
Dr_Cox1911 Posted December 5, 2017 Share Posted December 5, 2017 If anyone of you guys is still interested in: I made a mod that does this, you can find it here. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now