Ronni Posted March 11, 2014 Share Posted March 11, 2014 Hello , I want to make with that the player registering on the forum and he can login into server with your account at the forum , but i have this error : [00:55:49] SCRIPT ERROR: login\server.lua:7: 'then' expected near 'if' [00:55:49] ERROR: Loading script failed: login\server.lua:7: 'then' expected nea r 'if' Server - callRemote("http://urlexample", returnLoginAjax, email, password) function returnLoginAjax(name) local account = getAccount(email, password) if (account ~= false) then if name == "true" if (logIn(account, password) == true) then triggerClientEvent (player, "hideWindow", getRootElement()) else if name == "false" triggerClientEvent (player, "unknownError", getRootElement()) end else triggerClientEvent (player, "loginWrong", getRootElement()) end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, returnLoginAjax) Sorry My Bad English Link to comment
DNL291 Posted March 11, 2014 Share Posted March 11, 2014 function returnLoginAjax(name) local account = getAccount(email, password) if (account ~= false) then if name == "true" then if (logIn(account, password) == true) then triggerClientEvent (player, "hideWindow", getRootElement()) end elseif name == "false" then triggerClientEvent (player, "unknownError", getRootElement()) end else triggerClientEvent (player, "loginWrong", getRootElement()) end end You must define the player element, and email/password if it's not defined. Link to comment
Ronni Posted March 11, 2014 Author Share Posted March 11, 2014 thank you very much for help me , removed the first error, but now appeared 2 new errors [01:26:33] WARNING: login\server.lua:4: Bad argument @ 'getAccount' [Expected st ring at argument 1, got nil] [01:26:33] WARNING: login\server.lua:14: Bad argument @ 'triggerClientEvent' [Ex pected string at argument 1, got nil] Link to comment
xXMADEXx Posted March 11, 2014 Share Posted March 11, 2014 thank you very much for help me , removed the first error, but now appeared 2 new errors[01:26:33] WARNING: login\server.lua:4: Bad argument @ 'getAccount' [Expected st ring at argument 1, got nil] [01:26:33] WARNING: login\server.lua:14: Bad argument @ 'triggerClientEvent' [Ex pected string at argument 1, got nil] The variables "email" and "password" are not defined anywhere in the script. Link to comment
Ronni Posted March 11, 2014 Author Share Posted March 11, 2014 I don't know what else to do , i tried define , but i receive it edit : function returnLoginAjax(email, password) account = callRemote("http://portalgamer.net.br/admin/sources/base/mta.php?acao=login", returnLoginAjax, email, password) if account == "true" then outputChatBox ( "mt bem", getRootElement(), 255, 255, 255, false ) else outputChatBox ( "mt mal", getRootElement(), 255, 255, 255, false ) end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, returnLoginAjax) and chat show ''mt mal'' ( account wrong ) , debug don't show erros , some error? Link to comment
Saml1er Posted March 11, 2014 Share Posted March 11, 2014 function returnLoginAjax(email, password) if callRemote ("http://portalgamer.net.br/admin/sources/base/mta.php?acao=login", returnLoginAjax, email, password) then local account = getAccount(email, password) if logIn (account, password) == true then triggerClientEvent (source, "hideWindow", getRootElement()) end end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, returnLoginAjax) I added an if statement but this won't fix the problem tho, the email and password are nil means that they are not defined or you are sending them incorrectly. EDIT: Just found out that player was not defined so I changed it. 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