Issue with my event handlers.
ServerSide
local SQL_HOST = "127.0.0.1"
local SQL_USERNAME = "root"
local SQL_PASSWORD = ""
function connect()
accountsDatabase = dbConnect( "mysql", SQL_HOST, SQL_USERNAME, SQL_PASSWORD, "share=0" )
outputChatBox("connected")
checkExists()
triggerClientEvent("hideLoginWindow", getRootElement())
triggerClientEvent("hideRegisterWindow", getRootElement())
end
addEventHandler ( "onResourceStart", getRootElement(), connect )
ClientSide
--Display the login window to the root element
function displayLoginWindow()
--source is the player in this case.
guiSetVisible(loginWindow, true )
outputChatBox("displayed")
end
--Hide the login window to the root element
function hideLoginWindow()
--source is the player in this case.
guiSetVisible(loginWindow, false )
end
--Display the register window to the root element
function displayRegisterWindow()
--source is the player in this case.
guiSetVisible(registerWindow, true )
end
--Hide the login window to the root element
function hideRegisterWindow()
--source is the player in this case.
guiSetVisible(registerWindow, false )
end
--[[ LOGIN ALERT LABEL FUNCTIONS ]]--
--Set the login label to a custom message
function setLoginAlertLabel(message)
guiSetText( loginAlertLabel, message )
end
--"Your email or password maybe incorrect or doesn't exit. If the account \ndoesn't exist please create an account before attempting to login."
--[[ REGISTER ALERT LABEL FUNCTIONS ]]--
--Set the register label to a custom message
function setRegisterFullNameAlertLabel(message)
guiSetText( registerFullNameAlertLabel, message )
end
--Set the email alert label to a custom message
function setRegisterEmailAlertLabel(message)
guiSetText( registerEmailAlertLabel, message )
end
--Set the password alert label to a custom message
function setRegisterPasswordAlertLabel(message)
guiSetText( registerPasswordAlertLabel, message )
end
addEvent( "displayLoginWindow", true )
addEvent( "hideLoginWindow", true )
addEvent( "displayRegisterWindow", true )
addEvent( "hideRegisterWindow", true )
addEvent( "setLoginAlertLabel", true )
addEvent( "setRegisterFullNameAlertLabel", true )
addEvent( "setRegisterEmailAlertLabel", true )
addEvent( "setRegisterPasswordAlertLabel", true )
addEventHandler( "displayLoginWindow", getRootElement(), displayLoginWindow )
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow )
addEventHandler( "displayRegisterWindow", getRootElement(), displayRegisterWindow )
addEventHandler( "hideRegisterWindow", getRootElement(), hideRegisterWindow )
addEventHandler( "setLoginAlertLabel", getRootElement(), setLoginAlertLabel )
addEventHandler( "setRegisterFullNameAlertLabel", getRootElement(), setRegisterFullNameAlertLabel )
addEventHandler( "setRegisterEmailAlertLabel", getRootElement(), setRegisterEmailAlertLabel )
addEventHandler( "setRegisterPasswordAlertLabel", getRootElement(), setRegisterPasswordAlertLabel )
My meta:
<meta>
<!-- SCRIPT INFORMATION -->
<info author="Kieron Wiltshire" type="script" name="ZedLogin" description="Zed login script" />
<script src="gui.lua" type="client" />
<script src="login-server.lua" type="server" />
<script src="login-client.lua" type="client" />
</meta>