2013martin1212 Posted September 11, 2015 Posted September 11, 2015 I try to create a basic login panel, but when i was start the script it says: "triggered serverside event checkAccount, but not added server side" and there is my server.lua file addEvent("checkAccount", true) addEventHandler("checkAccount", root, function() local account = getAccount(getPlayerName(client)) if account then triggerClientEvent(client, "showLogin", client) else triggerClientEvent(client, "showRegister", client) end end ) addEvent("submitRegister", true) addEventHandler("submitRegister", root, function ( password ) local account = getAccount(getPlayerName(client), password) if account == false then local accountAdded = addAccount(getPlayerName(client), password) if accountAdded then outputChatBox("Thank you for registering", client) triggerClientEvent(client, "showLogin", client) else outputChatBox("Something was bad! Contact the administrator!!", client) end end ) addEvent("submitLogin", true) addEventHandler("submitLogin", root, function (password) local account = getAccount(getPlayerName(client), password) if account then if logIn(client, account, password ) == false then outputChatBox("You are already logged in!", client) end else kickPlayer(client,"Wrong Password!!") end end ) And there is my Client.lua please help to fix it thanks addEventHandler("onClientResourceStart", getResourceRootElement(), function () triggerServerEvent("checkAccount", getResourceRootElement()) end ) addEvent("showRegister", true) addEventHandler("showRegister", getRootElement(), function() createRegisterWindow() if (wdwRegister ~= nil ) then guiSetVisible(wdwRegister, true) else outputChatBox("An unexpected error has occured and the log in GUI has not been created.") end showCursor(true) guiSetVisible(true) end ) function clientSubmitRegister(button, state) if button == "left" and state == "up" then local password = guiGetText(edtPass) if password then triggerServerEvent("submitRegister", getRootElement(), password ) guiSetInputEnabled(false) guiSetVisible(wdwRegister, false ) showCursor( false ) else outputChatBox("Please enter the password.") end end end addEvent("showLogin", true) addEventHandler("showLogin", getRootElement(), function () createLoginWindow() if (wdwLogin ~= nil ) then guiSetVisible(wdwLogin, true) else outputChatBox("An unexpected error has occured 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 password = guiGetText(edtPass) if password then triggerServerEvent("submitLogin", getRootElement(), password) guiSetInputEnabled(false) guiSetVisible(false) showCursor(false) else outputChatBox("Please enter the password.") end end end function createRegisterWindow() local X = 0.375 local Y = 0.375 local Width = 0.20 local Height = 0.15 wdwRegister = guiCreateWindow(X, Y, Width, Height, "Registration", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwRegister) X = 0.425 Y = 0.2 Width = 0.5 Height = 0.15 edtPass = guiCreateEdit (X, Y, Width, Height, "", true, wdwRegister) guiEditSetMaxLenght(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnRegister = guiCreateButton(X, Y, Width, Height, "Register", true, wdwRegister) guiSetVisible(wdwRegister, false) addEventHandler("onClientGUIClick", btnRegister, clientSubmitRegister, false) end function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.20 local Height = 0.15 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Login", true) X = 0.0825 Y = 0.2 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLenght(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height= 0.20 btnLogin = guiCreateButton(X, Y, Width, Height, "Login", true, wdwLogin) guiSetVisible(wdwLogin, false) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) end
JR10 Posted September 11, 2015 Posted September 11, 2015 It's because the script doesn't load correctly. You're missing an end in the submitRegister event. addEvent("submitRegister", true) addEventHandler("submitRegister", root, function ( password ) local account = getAccount(getPlayerName(client), password) if account == false then local accountAdded = addAccount(getPlayerName(client), password) if accountAdded then outputChatBox("Thank you for registering", client) triggerClientEvent(client, "showLogin", client) else outputChatBox("Something was bad! Contact the administrator!!", client) end end end )
Al3grab Posted September 11, 2015 Posted September 11, 2015 It's because the script doesn't load correctly. You're missing an end in the submitRegister event. addEvent("submitRegister", true) addEventHandler("submitRegister", root, function ( password ) local account = getAccount(getPlayerName(client), password) if account == false then local accountAdded = addAccount(getPlayerName(client), password) if accountAdded then outputChatBox("Thank you for registering", client) triggerClientEvent(client, "showLogin", client) else outputChatBox("Something was bad! Contact the administrator!!", client) end end end ) is client pre-defined here ?
JR10 Posted September 11, 2015 Posted September 11, 2015 It's triggered from client-side, so yes, client is defined.
Al3grab Posted September 11, 2015 Posted September 11, 2015 It's triggered from client-side, so yes, client is defined. Sweet
2013martin1212 Posted September 12, 2015 Author Posted September 12, 2015 Thanks JR10 you save me again
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