seal Posted November 18, 2013 Share Posted November 18, 2013 Hey, i'm new in gui scripting, so this is my first gui and i need some help. It should ask a name and save it to an SQL database and finally close de window, but it dont happen, so pls help me! function createLoginWindow(thePlayer) local X = 0.425 local Y = 0.425 local Width = 0.15 local Height = 0.15 showCursor(true, true) wdwLogin = guiCreateWindow(X, Y, Width, Height, "Choose your character's name", true) X = 0.25 Y = 0.2 Width = 0.5 Height = 0.15 cname = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(cname, 15) X = 0.375 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Save", true, wdwLogin) addEventHandler ( "onClientGUIClick", btnLogin, saveNick, false ) outputDebugString( "You got ".. cname .." hp.") -- just for debugging end addCommandHandler("leves", createLoginWindow) function saveNick(button) if button == "left" then local nickname = guiGetText ( cname ) outputDebugString( "You got ".. cname .." hp.") executeSQLQuery("CREATE TABLE IF NOT EXISTS players ( name TEXT)") executeSQLQuery("INSERT INTO players(name) VALUES(?)", cname ) guiSetVisible(wdwLogin, false) showCursor ( false ) end end Link to comment
glowdemon1 Posted November 18, 2013 Share Posted November 18, 2013 You could replace guiSetVisible with destroyElement(wdwLogin), but it's probably caused by the MYSQL part where I can't really help ya with. 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