function autoLogin ( )
local cSerial = getPlayerSerial ( source )
local pass = sha256 ( cSerial )
local account = getAccount ( tostring ( cSerial ), pass )
if ( account ) then
logIn ( source, account, pass )
outputChatBox ( "Logged in successfully", source, 255, 255, 255 )
else
local account = addAccount ( tostring ( cSerial ), pass )
if ( account ) then
logIn ( source, account, pass )
outputChatBox ( "Registered and logged in successfully", source, 255, 255, 255 )
else
outputChatBox ( "Failed to register!", source )
end
end
end
addEventHandler ( "onPlayerJoin", root, autoLogin )
Use that and see if it outputs: "Failed to register!".