kevin433 Posted February 23, 2010 Share Posted February 23, 2010 Hi, I'm trying to make a GUI, but it doesn't show up when a client connects. That's my code, I've got no errors: function LoginWindow() --LOGIN FENSTER LoginFenster = guiCreateWindow(382,291,345,222,"Bitte einloggen!",false) guiWindowSetMovable(LoginFenster,false) guiWindowSetSizable(LoginFenster,false) --NICKNAME TEXT Nickname = guiCreateLabel(20,59,65,17,"Nickname:",false,LoginFenster) guiLabelSetColor(Nickname,255,255,255) guiLabelSetVerticalAlign(Nickname,"top") guiLabelSetHorizontalAlign(Nickname,"left",false) guiSetFont(Nickname,"default-bold-small") --PASSWORT TEXT Passwort = guiCreateLabel(21,111,65,17,"Passwort:",false,LoginFenster) guiLabelSetColor(Passwort,255,255,255) guiLabelSetVerticalAlign(Passwort,"top") guiLabelSetHorizontalAlign(Passwort,"left",false) guiSetFont(Passwort,"default-bold-small") --NICKNAME TEXTBOX NicknameBox = guiCreateEdit(89,52,219,32,"",false,LoginFenster) guiEditSetMaxLength(NicknameBox,20) --PASSWORT TEXTBOX PasswortBox = guiCreateEdit(88,107,219,32,"",false,LoginFenster) guiEditSetMaxLength(PasswortBox,20) --LOGIN BUTTON LoginButton = guiCreateButton(117,173,100,36,"Login",false,LoginFenster) guiSetFont(LoginButton,"default-bold-small") --REGISTER BUTTON RegisterButton = guiCreateButton(229,173,100,36,"Registrieren",false,LoginFenster) guiSetFont(RegisterButton,"default-bold-small") end addEventHandler("onClientPlayerJoin", getRootElement(), LoginWindow) Link to comment
driver2 Posted February 23, 2010 Share Posted February 23, 2010 onClientPlayerJoin is not triggered for the local player. What you want is onClientResourceStart: addEventHandler("onClientResourceStart",getResourceRootElement(),LoginWindow) Link to comment
MasterTobi Posted February 23, 2010 Share Posted February 23, 2010 hm you have to use the function guiBringToFront also : ....... RegisterButton = guiCreateButton(229,173,100,36,"Registrieren",false,LoginFenster) guiSetFont(RegisterButton,"default-bold-small") guiBringToFront(LoginFenster) end addEventHandler("onClientPlayerJoin", getRootElement(), LoginWindow) Link to comment
kevin433 Posted February 23, 2010 Author Share Posted February 23, 2010 onClientPlayerJoin is not triggered for the local player. What you want is onClientResourceStart: addEventHandler("onClientResourceStart",getResourceRootElement(),LoginWindow) But I want to show it for the player who joins. hm you have to use the function guiBringToFront also : ....... RegisterButton = guiCreateButton(229,173,100,36,"Registrieren",false,LoginFenster) guiSetFont(RegisterButton,"default-bold-small") guiBringToFront(LoginFenster) end addEventHandler("onClientPlayerJoin", getRootElement(), LoginWindow) Hm, that didn't work for me Link to comment
Jumba' Posted February 23, 2010 Share Posted February 23, 2010 onClientPlayerJoin is not triggered for the local player. What you want is onClientResourceStart: addEventHandler("onClientResourceStart",getResourceRootElement(),LoginWindow) But I want to show it for the player who joins. .. onClientResourceStart gets called when a player joined and has finished downloading the resource, that IS what you need to use, not onClientPlayerJoin. Link to comment
kevin433 Posted February 23, 2010 Author Share Posted February 23, 2010 It works now, thanks! But what's then "onClientPlayerJoin"? Link to comment
50p Posted February 23, 2010 Share Posted February 23, 2010 It works now, thanks! But what's then "onClientPlayerJoin"? https://wiki.multitheftauto.com/wiki/OnClientPlayerJoin If you have ever read wiki, you'd know. Link to comment
kevin433 Posted February 23, 2010 Author Share Posted February 23, 2010 It works now, thanks! But what's then "onClientPlayerJoin"? https://wiki.multitheftauto.com/wiki/OnClientPlayerJoin If you have ever read wiki, you'd know. I've already read about the function, and it says that it gets triggered when a player joins the server and that the source of this event is the player who joined the server. Link to comment
Jumba' Posted February 23, 2010 Share Posted February 23, 2010 It works now, thanks! But what's then "onClientPlayerJoin"? https://wiki.multitheftauto.com/wiki/OnClientPlayerJoin If you have ever read wiki, you'd know. I've already read about the function, and it says that it gets triggered when a player joins the server and that the source of this event is the player who joined the server. This event is triggered when a player joins a server. It is triggered for all players other than the local player. I know a period means full stop, but you should continue reading if there's more behind it Link to comment
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