Jump to content

[Question] removing account from serial


kieran

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...