Jump to content

Issue with my event handlers


Recommended Posts

Posted

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> 

Posted

And what is the problem?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

That's because the client side script loads after the server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Why do you even trigger a event to hide the GUI server side? you can just hide it client side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Hiding after login is one thing, and hiding when the resource starts from the server side is another.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...