Please, help, login problem.

Recommended Posts

Hello! I want to get an advice from you and a problem solution. Thanks in advance.

Bad argument @ "logIn" [Expected account at argument 2, got boolean]

the line is : if (logIn(player, account, password) == true) then

the script is :

function passwordHandler(player, oldpassword, newpassword)
 local account = getPlayerAccount(player)
 if (account) then
  if (isGuestAccount(account)) then
   outputChatBox("You must be logged in to change your password.", player)
  local playerName = getPlayerName(player)
  local password_check = getAccount(playerName, oldpassword)
  if (password_check ~= false) then
   if (string.len(newpassword) >= 5) then
    setAccountPassword(account, newpassword)
    triggerClientEvent(player, "hidePasswordWindow", getRootElement())
    outputChatBox("Your new password must be at least 5 characters long!", player)
   outputChatBox("Old password invalid.", player)
function loginHandler(player, username, password, thePlayer)
 local account = getAccount(username, password)
 if (account ~= false) then
  if (logIn(player, account, password) == true) then

setTimer( spawnPlayer, 2000,1,player, 925.329, 46.152, 80.908)

fadeCamera ( player, false, 1.0, 0, 0, 0 )
 setTimer ( fadeCamera, 5000, 1, player, true, 0.5 )
setElementFrozen(player, false)
setTimer( setCameraTarget,3200,1,player)
   triggerClientEvent (player, "hideLoginWindow1", getRootElement())
   triggerClientEvent (player, "unknownError", getRootElement())
  triggerClientEvent (player, "loginWrong", getRootElement())
function registerHandler(player, username, password)
 local account = getAccount(username, password)
 if (account ~= false) then
  triggerClientEvent(player, "registerTaken", getRootElement())
  account = addAccount(username, password)
  if (logIn(player, account, password) == true) then
   triggerClientEvent(player, "hideLoginWindow", getRootElement())

    setPlayerHudComponentVisible ( player, "radar", false )
  setTimer ( fadeCamera, 50, 1, player,false, 1 )
  setTimer ( fadeCamera, 3000, 1, player,true, 3 )
setTimer( spawnPlayer, 2250,1,player, 806.7,-1350,-0.4)
setTimer(setCameraMatrix,1500,1,player, 808,-1351,-0.4,-1000,0,0,0,0)
--setTimer(setElementPosition,2000,1,player, 806.7,-1350,-0.4)
   triggerClientEvent(player, "unknownError", getRootElement())
function setCameraOnPlayerJoin()
     fadeCamera(source, true, 5)
setTimer ( fadeCamera, 5000, 1, source, true, 0.5 )   
 setCameraMatrix(source, 1000.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin)
function hudChangerOnJoin ()
    setPlayerHudComponentVisible ( source, "radar", false )
showChat( source, false)
addEventHandler ( "onPlayerJoin", getRootElement(), hudChangerOnJoin )
function hudChangerOnLogin ()
    setPlayerHudComponentVisible ( source, "radar", true )
addEventHandler ( "onPlayerLogin", getRootElement(), hudChangerOnLogin )

function logoutHandler()--We define a function name
    local accountname = getAccountName (getPlayerAccount(source))--we get an account
    if (isGuestAccount(getPlayerAccount(source)) == true) then
    cancelEvent()--then cancelEvent
--triggerClientEvent("logOutOp", getRootElement())--output him to chatbox that logout is not allowed
addEventHandler("onPlayerLogout",getRootElement(),logoutHandler)--we add a event handler which will handle the funciton
function setCameraRegister(player, thePlayer)
setTimer(setElementPosition,1000,1,source, 925.329, 46.152, 80.908)
setTimer( setCameraTarget,1200,1, source )
setTimer ( fadeCamera, 50, 1, source,false, 1 )
  setTimer ( fadeCamera, 3000, 1, source,true, 3 )
setElementFrozen ( source, false )
    setPlayerHudComponentVisible ( source, "radar", true )
showChat(source, true)
addEvent("setCameraRegister", true)
addEvent("submitChangepw", true)
addEvent("submitLogin", true)
addEvent("submitRegister", true)
addEventHandler("submitChangepw", root, passwordHandler)
addEventHandler("submitLogin", root, loginHandler)
addEventHandler("submitRegister", root, registerHandler)
addEventHandler("setCameraRegister", root, setCameraRegister)
Edited by Marshell

Share this post

Link to post

if account = false (boolean) then the problem is somewhere around here

getAccount(username, password)

Also i don't see any "submitLogin" event triggering in your code. Possible problems:

- "submitLogin" event arguments are missing

- "submitLogin" event arguments are incorrect and getAccount function says "i don't know this person"

Edited by JeViCo

Share this post

Link to post

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.