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