Hello to all. I'm getting warnings like this, how can I fix them?
WARNING: S\admin_sys.lua:21: Access denied @ 'addAccount'
WARNING: S\admin_sys.lua:22: Bad argument @ 'setAccountData' [Expected account at argument 1, got nil]
WARNING: S\admin_sys.lua:38: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean]
WARNING: S\admin_sys.lua:39: Bad argument @ 'passwordVerify' [Expected string at argument 2, got boolean]
local MINIMUN_PASSWORD_LENGTH = 6
local function isPasswordValid(password)
return string.len(password) >= MINIMUN_PASSWORD_LENGTH
end
addCommandHandler('reg', function (player, command, username, password)
if not username or not password then
return outputChatBox('SYNTAX: /' .. command .. ' [username][password]', player, 255, 255, 255)
end
if getAccount(username) then
return outputChatBox('An account already exists with that name.', player, 255, 100, 100)
end
if not isPasswordValid(password) then
return outputChatBox('The password supplied was not valid.', player, 255,100,100)
end
passwordHash(password, 'bcrypt', {}, function (hashedPassword)
local account = addAccount(username, hashedPassword)
setAccountData(account, 'hashed_password', hashedPassword)
outputChatBox('Your account has been successfully created! You may now login with /log', player, 100, 255, 100)
end)
end, false, false)
addCommandHandler('log', function (player, command, username, password)
if not username or not password then
return outputChatBox('SYNTAX: /' .. command .. ' [username] [password]', player, 255, 255, 255)
end
local account = getAccount(username)
if not account then
outputChatBox('No such account could be found with that username or password.', player, 255, 100,100)
end
local hashedPassword = getAccountData(account, 'hashed_password')
passwordVerify(password, hashedPassword, function (isValid)
if not isValid then
return outputChatBox('No such account could be found with that username or password.', player, 255, 100,100)
end
if logIn(player, account, hashedPassword) then
return outputChatBox('You have successfully logged in!', player, 100,255,100)
end
return outputChatBox('An unknown error occured while attempting to authenticate.', player, 255, 100, 100)
end)
end, false, false)