Jump to content

[REQ] login system


Recommended Posts

/register is a command in admin panel, /login and /logout are hardcoded mta commands

Custom login system would be required for RPGs/massive gamemodes.

You do not need to make a custom login system at all... this will make things only harder. Build-in login system relies on mta accounts and server ACL, so i'd not recommend using any other system than that

Link to comment

If function like setAccountData deletes all the accounts then why should I use that? DP3 will come out - nobody knows when - and it's not been said it'll be fixed. I stopped using accounts features when I found out that setAccountData deletes accounts, since that function is used the a lot.

Imagine running 10 resources and each of them having say 4 variables saved in an account and you have 1000 accounts. How long would that take to get some data from such big accounts.xml file? XML is just plain text. Why not creating custom register system using SQLite? That would speed things up.

Link to comment
/register is a command in admin panel, /login and /logout are hardcoded mta commands

Is there any way to cancel or forbid the native, hardcoded /login and /register, etc. commands from being used, or if that's not possible, is there any way to restrict it from writing and reading from the native accounts file? I'm coding a register/login system with a MySQL database and for increased security, I'm having my passwords hashed and by letting it also simultaneously create an account the 'regular' way, with an .xml file, it defeats the purpose of hashing passwords, as they'll be viewable, unhashed, in the .xml file.

Much luv,

Morellay

:P

Link to comment
If function like setAccountData deletes all the accounts then why should I use that? DP3 will come out - nobody knows when - and it's not been said it'll be fixed. I stopped using accounts features when I found out that setAccountData deletes accounts, since that function is used the a lot.

Imagine running 10 resources and each of them having say 4 variables saved in an account and you have 1000 accounts. How long would that take to get some data from such big accounts.xml file? XML is just plain text. Why not creating custom register system using SQLite? That would speed things up.

setAccountData deletes stuff if you set data on a guest account, so check if player's accounts is guest one before setting data? i use that on my server and never had problems

quick fix

_setAccoutData = setAccounData 
function setAccountData ( account, data, value ) 
  if ( not isGuestAccount ( account ) ) then 
    return _setAccountData ( account, data, value ) 
  end 
  return false 
end 

Else you could save stuff anywhere you want still using build-in accounts, i see a lot of disadvantage using alternative accounts system

Link to comment
If function like setAccountData deletes all the accounts then why should I use that? DP3 will come out - nobody knows when - and it's not been said it'll be fixed. I stopped using accounts features when I found out that setAccountData deletes accounts, since that function is used the a lot.

Imagine running 10 resources and each of them having say 4 variables saved in an account and you have 1000 accounts. How long would that take to get some data from such big accounts.xml file? XML is just plain text. Why not creating custom register system using SQLite? That would speed things up.

setAccountData deletes stuff if you set data on a guest account, so check if player's accounts is guest one before setting data? i use that on my server and never had problems

quick fix

_setAccoutData = setAccounData 
function setAccountData ( account, data, value ) 
  if ( not isGuestAccount ( account ) ) then 
    return _setAccountData ( account, data, value ) 
  end 
  return false 
end 

Else you could save stuff anywhere you want still using build-in accounts, i see a lot of disadvantage using alternative accounts system

Look into my "bank" resource, I do check whether account is a guest account and if it isn't then I setAccountData.

Link to comment

yes there have been some problem with me at my server, all time me and my friend use /register and make ourself admins, we dissapear from the list even if i do all this manually. 1 i close the server 2 goes to aqqounts and sets my aqq name and that stuff 3 then to ACL where i do so i can login at the panel 4. i start the server, all goes perfekt. 5 i stop the server 6. i start the server and my aqqount is missing.

this problem happened when i fixed the bank script from 50p and it is something wrong with it i think,it was going well b4 i got the banking system, i hope you can fix it or help me too fix it cuz its a little anoying :P

Link to comment

hi all =)

I want to make GUI based login-register system. I already created GUI but i dont know how to make login script, wiki "login funktion" page has no example((( with register is all ok, i the script from Lil Toady admin panel, can anyone make for me login script?

function aRegister ( localPlayerName, username_register , password_register) 
    if ( password_register ~= nil ) then                 
        if ( string.len ( password_register  ) < 4 ) then 
        outputChatBox ( "register: - Password should be at least 4 characters long", player, 243, 0, 0 ) 
        elseif  (localPlayerName ~= username_register) then 
        outputChatBox ( "register: - Your login and your nick must be the same.", player, 243, 0, 0 ) 
        elseif ( addAccount ( username_register , password_register  ) and localPlayerName == username_register) then 
            outputChatBox ( "You have successfully registered! Username: '"..username_register.."', Password: '"..password_register.."'(Remember it)", player, 109, 243, 0 ) 
        elseif ( getAccount ( username_register ) ) then 
            outputChatBox ( "register: - Account with this name already exists.", player, 243, 0, 0 ) 
        else 
            outputChatBox ( "register: - Unknown Error", player, 243, 0, 0 ) 
        end 
    else 
    outputChatBox ( "register: - Error! Please type your password!'", player, 243, 0, 0 ) 
end 
end 
addEvent("onRegister", true) 
addEventHandler("onRegister", getRootElement(), aRegister) 

PS: Can anyone say how to use guiGetInputEnabled ()? i need to disable "t", "y" buttons when typing text in edit fields.

Link to comment

guiSetInputEnabled:

This function enables or disables input focus for the GUI. This means that any keybinds or MTA binds are overidden so that text can be input into an editbox, for example. In other words, keys such as t and y which activate the chatbox are disabled.

Make simple form and a function attached to a submit button. Use triggerServerEvent to send the data that player's entered and do a check if the data is correct (using getAccount).

Always look on wiki: http://development.mtasa.com/index.php?title=Main_Page

Link to comment

I have allready form, function attached to a submit button. triggerserverevent send login and password, on serverside i have getAccount data check, then getclientAccount for login function... but when i try to login in game, i get "attempt to call global 'login' " error, here is my script

function aLogin  (localplayername, username_login , password_login  ) 
    if ( password_login ~= nil ) then 
        if ( string.len ( password_login  ) < 4 ) then 
            outputChatBox ( "authentication: - Password should be at least 4 characters long", source, 243, 0, 0) 
        elseif (getAccount (username_login, password_login) ) then 
            local theAccount = getClientAccount ( source ) 
            if (theAccount) then 
            local playerlogin = login(source, theAccount, password_login) 
                if (playerlogin) then 
                    outputChatBox ( "You have successfully login: "..username_login.."!", source, 109, 243, 0 )  
                end  
            ebd  
        elseif (theAccount ~= getAccount (username_login, password_login) ) then 
            outputChatBox ( "authentication: - Wrong password!", source, 243, 0, 0 ) 
        else 
            outputChatBox ( "authentication: - Account not exists!", source, 243, 0, 0 ) 
        end 
    else 
        outputChatBox ( "authentication: - Please type your login and password!'", source, 243, 0, 0 ) 
  
  
end 
end 
addEvent("onLogin", true) 
addEventHandler("onLogin", getRootElement(), aLogin) 
  

Link to comment

I have allready form, function attached to a submit button. triggerserverevent send login and password, on serverside i have getAccount data check, then getclientAccount for login function... but when i try to login in game, i get "attempt to call global 'login' " error, here is my script

function aLogin  (localplayername, username_login , password_login  ) 
    if ( password_login ~= nil ) then 
        if ( string.len ( password_login  ) < 4 ) then 
            outputChatBox ( "authentication: - Password should be at least 4 characters long", source, 243, 0, 0) 
        elseif (getAccount (username_login, password_login) ) then 
            local theAccount = getClientAccount ( source ) 
            if (theAccount) then 
            local playerlogin = login(source, theAccount, password_login) 
                if (playerlogin) then 
                    outputChatBox ( "You have successfully login: "..username_login.."!", source, 109, 243, 0 )  
                end  
            ebd  
        elseif (theAccount ~= getAccount (username_login, password_login) ) then 
            outputChatBox ( "authentication: - Wrong password!", source, 243, 0, 0 ) 
        else 
            outputChatBox ( "authentication: - Account not exists!", source, 243, 0, 0 ) 
        end 
    else 
        outputChatBox ( "authentication: - Please type your login and password!'", source, 243, 0, 0 ) 
  
  
end 
end 
addEvent("onLogin", true) 
addEventHandler("onLogin", getRootElement(), aLogin) 
  

Link to comment

ok i'm changed

local theAccount = getClientAccount ( source ) 
  

to

local theAccount = getAccount (username_login, password_login) 
  

but still the same error(((

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