CTCCoco Posted February 19, 2010 Posted February 19, 2010 I use the command and have an error. In the console I see " Bad argument @ 'LogIn' - Line 23 " What's the problem? Thanks. function loginPlayer ( source, commandName, password ) -- local registrado = getAccount( getPlayerName(thePlayer), password) if ( password ~= "" and password ~= nil ) then local logueado = logIn( source, getPlayerName(source), password ) if ( logueado ) then outputChatBox( "Gracias " ..getPlayerName(source) ..", te has logueado con éxito.", source ) else outputChatBox ( "Ha ocurrido un error. Porfavor pide ayuda a un admin.", source ) end else outputChatBox ( "Usa /loguearse <contrasena>.", source ) end end addCommandHandler("loguearse", loginPlayer) -- Lo añade el comando
Andre9977 Posted February 19, 2010 Posted February 19, 2010 (edited) logIn doesn't take the player's name as the second parameter as it seems. Look into getAccount for the account I suppose as you did in the example but commented it out. I suppose you could do this... if(logIn(source, getAccount(getPlayerName(source)), password)) then outputChatBox( "Gracias " ..getPlayerName(source) ..", te has logueado con éxito.", source ) else outputChatBox ( "Ha ocurrido un error. Porfavor pide ayuda a un admin.", source ) end However I'm not sure as it is fairly confusing without proper documentation. Edited February 19, 2010 by Guest
CTCCoco Posted February 19, 2010 Author Posted February 19, 2010 Why you use thePlayer in some places and source in other? Thanks for the help.
Andre9977 Posted February 19, 2010 Posted February 19, 2010 Why you use thePlayer in some places and source in other? Thanks for the help. Because that's what you did in your code. I didn't check the parameter for getPlayerName.
CTCCoco Posted February 19, 2010 Author Posted February 19, 2010 Why you use thePlayer in some places and source in other? Thanks for the help. Because that's what you did in your code. I didn't check the parameter for getPlayerName. This doesn't work yet only work the register but thanks for try help me ..
Jason_Gregory Posted February 20, 2010 Posted February 20, 2010 This doesn't work yet only work the register but thanks for try help me .. Tell us what exactly is going wrong. Stil the logIn Function ?
CTCCoco Posted February 20, 2010 Author Posted February 20, 2010 This doesn't work yet only work the register but thanks for try help me .. Tell us what exactly is going wrong. Stil the logIn Function ? Now I have: function loginPlayer ( thePlayer, commandName, password1 ) if ( password1 ) then --[[local playerName = getPlayerName(thePlayer) local targetPlayer = getPlayerName ( playerName )--]] local targetAccount = getPlayerAccount ( thePlayer ) -- Checking if the player actually exists if(logIn(thePlayer, targetAccount, password1)) then outputChatBox( "Gracias " ..getPlayerName(thePlayer) ..", te has logueado con éxito.", thePlayer ) else outputChatBox ( "Ha ocurrido un error. Porfavor pide ayuda a un admin.", thePlayer ) end else outputChatBox ( "Usa /loguearse <contrasena>.", thePlayer ) end end addCommandHandler("loguearse", loginPlayer) -- Lo añade el comando Its only detect the account "guest" because its the default account. How I can put the nick of the player in the logIn fuction? ( getPlayerName and getPlayerFromName doesn't work ). Please help me an thanks.
50p Posted February 21, 2010 Posted February 21, 2010 ....Its only detect the account "guest" because its the default account. How I can put the nick of the player in the logIn fuction? ( getPlayerName and getPlayerFromName doesn't work ). Please help me an thanks. logIn function asks you for 3 arguments. - thePlayer: The player to log into an account- theAccount: The account to log the player into - thePassword: The password needed to sign into this account getPlayerAccount gives you account that player is currently using.. What's the point of logging into the same account which is also guest account? Think about it. What you want is get an already created account of the players. Look at the accounts function and what do you see there? Oh, there is getAccount function, I wonder what does it do? This function returns an account for a specific user. Do you think you may use this function? Is it what you want? local ACCOUNT = getAccount( getPlayerName( player ) ); logIn( player, ACCOUNT, password );
CTCCoco Posted February 21, 2010 Author Posted February 21, 2010 Thanks for all, I don't see that fuction. Sorry for my noob question.
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