Jump to content

GUI doesn't show up....


kevin433

Recommended Posts

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

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
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
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
It works now, thanks! :D 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 :P

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...