kieran Posted January 23, 2018 Share Posted January 23, 2018 Hello, I am making my first ever serial based login script, how it works is the player joins, triggers an event client side, if a file exists with the players password, it gets that password, otherwise it randomly generates letters and numbers and sets that as the account password and makes an xml file with the password... The problem is, I was curious to see if it generated secure passwords, good news, IT DID! But.... It meant deleting the old one and now me being a fool like I am, I have the wrong password, and long story short, I want to find a way to check if the password is refused... And a little info on setAccountPassword would be appreciated, gave it a try but it failed, here is my server code where I have the issue. function getOrSetPass() triggerClientEvent(source, "loginSerialPass", source)--Trigger event when player joins to fetch/create the password end addEventHandler("onPlayerJoin", root, getOrSetPass) function PlayerLogin(pass) --Carry the password to server side from a trigger event local username = getPlayerSerial( source ) --Get players serial local account = getAccount ( username, pass ) --Get the players account if ( account == false ) then --If the account does not exist addAccount(tostring(username), pass) --Add it account = getAccount ( username ) --Get the new account logIn(source, account, pass) --Log the player in else --HERE IS WHERE I WANT IT TO CHECK IF PASSWORD IS NOT CORRECT setAccountPassword(account, tostring(pass)) logIn(source, account, pass) end end addEvent("loginSerial",true) addEventHandler("loginSerial",getRootElement(),PlayerLogin) Thanks for any help. Link to comment
kieran Posted January 23, 2018 Author Share Posted January 23, 2018 Can't edit post, but fixed it, I forgot that logIn returns false if you failed to log on, just needed an if to check if it was false and if it was, change the password for the account. 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