Jump to content

logIn


Tekken

Recommended Posts

Why i get this error?

Error: WARNING: login\login_s.lua:6: Bad argument @ 'logIn' [Expected account at argument 2, got string 'username']

Code:

Server:

addEvent("loginPlayer", true) 
addEventHandler("loginPlayer", getRootElement(), 
function(username,password) 
    local acc = getAccount(username,password) 
    if acc then 
        logIn(source, username, password)   
    else 
        outputChatBox("[Login] Check username and password!", source, 255, 0, 0, true) 
        return   
    end 
end) 

Client:

addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), 
function() 
    if (source == login_but) then 
        username = guiGetText(the_user) 
        password = guiGetText(the_pass) 
        if username ~= "" and password ~= "" then 
            triggerServerEvent("loginPlayer", localPlayer, username, password) 
        else 
            outputChatBox("[Login] Please complet username and password!", 255, 0, 0) 
            return   
        end 
    end 
end) 

Link to comment
-- Client side 
addEventHandler("onClientGUIClick", getResourceRootElement(getThisResource()), 
function() 
    if (source == login_but) then 
        username = guiGetText(the_user) 
        password = guiGetText(the_pass) 
        if username ~= "" and password ~= "" then 
            triggerServerEvent("loginPlayer", localPlayer, username, password) 
        else 
            outputChatBox("[Login] Please complet username and password!", 255, 0, 0) 
            return   
        end 
    end 
end) 
  
-- Server side 
addEvent("loginPlayer", true) 
addEventHandler("loginPlayer", getRootElement(), 
function(username,password) 
    local acc = getAccount(username,password) 
    if acc then 
        logIn(source, acc, password)   
    else 
        outputChatBox("[Login] Check username and password!", source, 255, 0, 0, true) 
        return   
    end 
end) 

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...