Jump to content

Autologin problem. Help!


KITT1995

Recommended Posts

I have created this script to do autologin by serial number. This is the code:

function autoLogin() 
   local serial = getPlayerSerial (source) 
   if serial == "952E9E639B755C4E8010E55E67945635" then 
   logIn (source,  "test", "123456" ) 
   end 
end 
addEventHandler("onPlayerJoin", root, autoLogin) 

When I join in (that is my serial), i get an error in the server log

WARNING: autologin\script.lua:4: Bad argument @ 'logIn' [Expected account at argument 2, got string 'test'] 

Can someone help me? Thanks

Link to comment
https://wiki.multitheftauto.com/wiki/LogIn

2nd argument is an account element, not a string.

this makes no sense. onPlayerLogin obviously gets triggered when the player has logged in, so forcing logIn function again will not work. Read about it in the wiki. It says it returns false or nil in this case.

tell us what you're trying to do and we'll find a workaround hopefully :)

What I'm trying to do is that when a playet that is admin join in the server, get instantly login instead of writing everytime his account's username and pass.

Link to comment

Ok i get it working. This is the code:

function autoLogin() 
   local serial = getPlayerSerial (source) 
   if serial == "serialoftheplayer" then 
   local account = getAccount ( "accountname", "accountpassword" ) 
   logIn (source, account, "accountpassword") 
   end 
end 
addEventHandler("onPlayerJoin", root, autoLogin) 

I hope it can be helpful

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