Jump to content

Issue with logIn function


GTX

Recommended Posts

Hello! I'll explain: When a player with the serial where the serial variable is written joins then the logIn function log in the player automatically.

I can't explain better but here is the script:

local serial = "serial" 
local account = "gtx" 
local password = "password" -- I will not show all the details here 
  
function connect() 
if getPlayerSerial(source) == serial then 
logIn(source, account, password) 
else 
outputChatBox("WELCOME!") 
end 
end 
addEventHandler("onPlayerJoin", getRootElement(), connect) 
  

Link to comment

Try

local serial = "serial" 
local account = "gtx" 
local password = "password" -- I will not show all the details here 
  
function connect() 
    if getPlayerSerial(source) == serial then 
        local acc = getAccount( account,password ) 
        if acc then 
            logIn(source, acc, password) 
        else 
            outputChatBox( "can't get account" ) 
        end 
    else 
        outputChatBox("WELCOME!") 
    end 
end 
addEventHandler("onPlayerJoin", root, connect ) 
  
  

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