KITT1995 Posted August 8, 2011 Share Posted August 8, 2011 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
BinSlayer1 Posted August 8, 2011 Share Posted August 8, 2011 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 Link to comment
KITT1995 Posted August 8, 2011 Author Share Posted August 8, 2011 https://wiki.multitheftauto.com/wiki/LogIn2nd 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
Castillo Posted August 8, 2011 Share Posted August 8, 2011 You'll need player account(s) and password(s) if you want to autologin him. Link to comment
KITT1995 Posted August 8, 2011 Author Share Posted August 8, 2011 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now