Spider Pork Posted May 29, 2010 Share Posted May 29, 2010 Hey there! Recently the console outputs these warnings to me when I attempt to register: [09:15:25] WARNING: script.lua: Access denied @ 'addAccount' - Line: 77 [09:15:25] WARNING: script.lua: Bad argument @ 'logIn' - Line: 78 The lines are these two (server-side script): [...] account = addAccount(user, pass) if(logIn(player, account, pass) == true) then [...] Has anyone got any clue of what's wrong here? If anything's missing, please let me know. Thanks. Link to comment
robhol Posted May 29, 2010 Share Posted May 29, 2010 Your resource needs to be added to ACL. Turn off your server and edit the file (look at the other resource entries in the admin group) or I think you can do it with the admin panel. Link to comment
Spider Pork Posted May 29, 2010 Author Share Posted May 29, 2010 Fixed the "Access denied" warning. Now my problem is the "Bad argument" warning when I use logIn. Here's the onRegister event: function onRegister(player, user, pass) local account = getAccount(user, pass) if(account ~= false) then if(logIn(player, account, pass) == true) then triggerClientEvent("hideLoginWindow", getRootElement()) outputChatBox("You have been successfully logged in.", player) else outputChatBox("Error: Invalid password, username or already logged in.", player) end else account = addAccount(user, pass) if(logIn(player, account, pass) == true) then triggerClientEvent("hideLoginWindow", getRootElement()) outputChatBox("You have been successfully registered and logged in.", player) else outputChatBox("Error: Invalid password, username or already logged in.", player) end end end and onLogin: function onLogin(player, user, pass) local account = getAccount(user, pass) if(account ~= false) then if(logIn(player, account, pass) == true) then triggerClientEvent("hideLoginWindow", getRootElement()) outputChatBox("You have been successfully logged in.", player) else outputChatBox("Error: Invalid password, username or already logged in.", player) end else outputChatBox("Error: Invalid username or password.", player) end end Link to comment
Dark Dragon Posted May 29, 2010 Share Posted May 29, 2010 logIn requires a string of the account name, not the account, use your "user" variable Link to comment
Spider Pork Posted May 29, 2010 Author Share Posted May 29, 2010 I've already tried that. It always returns false. [...] if(logIn(player, user, pass) == true) then [...] Link to comment
kevin11 Posted May 29, 2010 Share Posted May 29, 2010 this is from wiki i believe you will see what you did wrong function clientSubmitLogin(button,state) if button == "left" and state == "up" then -- get the text entered in the 'username' field local username = guiGetText(edtUser) -- get the text entered in the 'password' field local password = guiGetText(edtPass) -- if the username and password both exist if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", getRootElement(), username, password) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end Link to comment
Spider Pork Posted May 29, 2010 Author Share Posted May 29, 2010 this is from wiki i believe you will see what you did wrong function clientSubmitLogin(button,state) if button == "left" and state == "up" then -- get the text entered in the 'username' field local username = guiGetText(edtUser) -- get the text entered in the 'password' field local password = guiGetText(edtPass) -- if the username and password both exist if username and password then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", getRootElement(), username, password) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end I see what you're trying to say. But the code I posted is in the server-side script, not the client-side. It uses triggerServerEvent because it's in the client-side script, right? The example from the wiki is in the client-side script. Link to comment
Taalasmaa Posted May 31, 2010 Share Posted May 31, 2010 We need your client-side too to help you. It goes wrong in client-side trigger. Link to comment
Spider Pork Posted May 31, 2010 Author Share Posted May 31, 2010 This is where it triggers the event: function onClickBtn(button, state) if(button == "left" and state == "up") then if(source == BtnAction) then if(guiGetSelectedTab(TabPanel) == TabLogin) then triggerServerEvent("onLogin", getRootElement(), getPlayerName(getLocalPlayer()), guiGetText(LoginUsername), guiGetText(LoginPassword)) else triggerServerEvent("onRegister", getRootElement(), getPlayerName(getLocalPlayer()), guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) end end end end 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