TorNix~|nR Posted December 13, 2017 Share Posted December 13, 2017 Hello guys, I made a register max attemps for users, a maximum 3 accounts for each serial but I don't know where is the problem, help please? function register(username, password) if (getAccountCount(source) >= 3) then displayServerMessageLogin(source, "Error", "warning") return end if not (username == "") then if not (password == "") then local account = getAccount(username, password) if (account == false) then local accountAdded = addAccount(tostring(username), tostring(password)) if (accountAdded) then displayServerMessageLogin(source, "Login: "..username.." | Password: "..password.."", "confirm") else displayServerMessageLogin(source, "Error, please try again", "warning") end else displayServerMessageLogin(source, "This user name already exists", "warning") end else displayServerMessageLogin(source, "Type your password", "warning") end else displayServerMessageLogin(source, "Enter your username", "warning") end end addEvent("register", true) addEventHandler("register", getRootElement(), register) function getAccountCount(player) local serial = getPlayerSerial(player) local accounts = getAccountsBySerial(serial) if(accounts) and (type(accounts == "table")) then return #accounts end return false end Link to comment
TorNix~|nR Posted December 13, 2017 Author Share Posted December 13, 2017 No debug I don't know the problem Problem fixed, thank you guys. Link to comment
DiGiTal Posted December 13, 2017 Share Posted December 13, 2017 if(accounts) and (type(accounts == "table")) then return #accounts end return false end I think here wrong. Type accounts =table Link to comment
Tails Posted December 13, 2017 Share Posted December 13, 2017 2 hours ago, TorNix~|nR said: No debug I don't know the problem Problem fixed, thank you guys. Would be nice if you told people what you did to fix it. Now you're just wasting everyone's time reading this topic. 3 Link to comment
TorNix~|nR Posted December 14, 2017 Author Share Posted December 14, 2017 It was a little problem the code I post is correct, but I use the incorrect one I use this function getAccountCount(player) local serial = getPlayerSerial(player) local accounts = getAccountsBySerial(serial) if(accounts) and (type(accounts == "table")) then return end return false end instead of function getAccountCount(player) local serial = getPlayerSerial(player) local accounts = getAccountsBySerial(serial) if(accounts) and (type(accounts == "table")) then return #accounts end return false end Thank you for asking. 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