Shazzimal Posted February 14, 2013 Posted February 14, 2013 Hey, I was just trying to make my first script. Wat I was making is: When someone joins my server, there will come up a GUI window, on that window are comming some rules commands etc. i maked this script and meta: server.lua addEventHandler("onPlayerJoin",getRootElement(), function createWelcomeMessage() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwWelcome = guiCreateWindow(X, Y, Width, Height, "Welcome to my server.", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Welcome to my server! etc...") guiSetVisible(wdwWelcome, false) end meta.xml <meta> <info author="Shazzimal" name="welcomeMessage" version="1.0" disc="Will create a welcome message at join."/> <script src="server.lua"/> </meta> I tried to run it on my server but my server, doesn't recognized it, why? Thanks
iPrestege Posted February 14, 2013 Posted February 14, 2013 and you have some wrongs on create the label .
iPrestege Posted February 14, 2013 Posted February 14, 2013 wdwWelcome = { } local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwWelcome = guiCreateWindow(X, Y, Width, Height, "Welcome to my server.", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Welcome to my server! etc..." , true , wdwWelcome)
Anderl Posted February 14, 2013 Posted February 14, 2013 wdwWelcome = { } local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwWelcome = guiCreateWindow(X, Y, Width, Height, "Welcome to my server.", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Welcome to my server! etc..." , true , wdwWelcome) There is no need for declaring a table variable with the name 'wdwWelcome'.
iPrestege Posted February 14, 2013 Posted February 14, 2013 wdwWelcome = { } local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwWelcome = guiCreateWindow(X, Y, Width, Height, "Welcome to my server.", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Welcome to my server! etc..." , true , wdwWelcome) There is no need for declaring a table variable with the name 'wdwWelcome'. Thanks .
Shazzimal Posted February 14, 2013 Author Posted February 14, 2013 Thanks for your help guys, but what is the different between server- en client side. And must i add the addEventHandler, or?
iPrestege Posted February 14, 2013 Posted February 14, 2013 The server side will happen to all on the server .
Shazzimal Posted February 14, 2013 Author Posted February 14, 2013 (edited) To all players? And what does client side? Must i add the addEventHandler? Edited February 14, 2013 by Guest
Castillo Posted February 14, 2013 Posted February 14, 2013 Some functions/events are client or server side only, like all GUI/DX drawing functions are client side only, you can't use them server side.
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 But mustn't i use addEventHandler at playerjoin?
iPrestege Posted February 15, 2013 Posted February 15, 2013 But mustn't i use addEventHandler at playerjoin? You do not need when the player join because it is the window will be visible.
Shazzimal Posted February 15, 2013 Author Posted February 15, 2013 Oke, i am always going to add a command to open it, just add this? addCommandHandler(Welcome, function ... ) Wich function must i use?
iPrestege Posted February 15, 2013 Posted February 15, 2013 addCommandHandler("open", function () guiSetVisible(wdwWelcome,true) showCursor(true) end)
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