Greenhound Posted December 16, 2012 Share Posted December 16, 2012 I've been following the wiki tutorials - I'm up to the GUI one and I've clearly messed something up. I've looked it up and down and can't see the problem. Can somebody take a look? http://www.mediafire.com/?bhx99kswo5wsspm Link to comment
Castillo Posted December 16, 2012 Share Posted December 16, 2012 We need more information, do you get any debug error? to check that write: "/debugscript 3" in the chat when logged as Admin. Link to comment
Greenhound Posted December 16, 2012 Author Share Posted December 16, 2012 I did debugscript and found the problem that was stopping the guis from showing, and fixed it. Now there's a new problem - clicking log in does nothing. Link to comment
Castillo Posted December 16, 2012 Share Posted December 16, 2012 No errors or anything? Link to comment
Greenhound Posted December 16, 2012 Author Share Posted December 16, 2012 No, can you take a look at the script in the first post? It can't be hard for somebody who knows what they're doing to spot the problem. Link to comment
Greenhound Posted December 16, 2012 Author Share Posted December 16, 2012 Fixed. I did triggerServerEvent("submitLogin", getRootElement, username, password) but it should have been triggerServerEvent("submitLogin", getRootElement(), username, password) the lack of parenthesis made it think getRootElement was a function. Also there were a few capitalization typos in my script. Link to comment
Castillo Posted December 16, 2012 Share Posted December 16, 2012 gui.lua: function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Welcome to the server", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 15) guiEditSetMaxLength(edtPass, 15) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) guiSetVisible(wdwLogin, false) end addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) createLoginWindow ( ) outputChatBox("Welcome to My MTA:SA Server, please log in.") if (wdwLogin ~= nil) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occurred and the log in GUI has not been created.") end showCursor(true) guiSetInputEnabled(true) end ) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", localPlayer, username, password) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Please enter a username and password") end end end Errors I have found: 1: You we're using 'getRootElement' and that's wrong, because you should have used 'getRootElement ( )'. 2: You put "submitlogin" instead of "submitLogin" with upper case "L". Link to comment
Greenhound Posted December 16, 2012 Author Share Posted December 16, 2012 Beat you to it, lol. Thanks for trying to help anyway. 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