Jump to content

Solved


1LoL1

Recommended Posts

Hello, i created Register system but i have here 1 error and i don't know how to fix. Can anyone please help me?

When i registered account with user "TEST" and password "TEST" it's works but when i again want registered new account with user "test" and paswrod "TEST" it's say account was registered but it's not :(

addEvent("Register",true) 
addEventHandler("Register",getRootElement(), 
    function (user,pass) 
    if user ~= "" then 
        if pass ~= "" then 
        if (string.len(pass) >= 4) then 
        local account = getAccount(user,pass) 
        if (account) then 
            outputChatBox("[!] Account: '"..user.."' exists  [!]", source, 255, 0, 0, true) 
        else 
            addAccount(user,pass) 
            outputChatBox("[!] Account: '"..user.."' | Password: '"..pass.."' [!]", source, 255, 0, 0, true) 
            end 
            else 
            outputChatBox("[!] Your password must be at least 4 characters long [!]", source, 255, 0, 0, true) 
            end 
        else 
            outputChatBox("[!] Password can not be blank [!]", source, 255, 0, 0, true) 
        end 
    else 
        outputChatBox("[!] Login can not be blank [!]", source, 255, 0, 0, true) 
    end 
end) 

Edited by Guest
Link to comment

Try this:

addEvent("Register",true) 
addEventHandler("Register",getRootElement(), 
    function (user,pass) 
    if user ~= "" then 
        if pass ~= "" then 
        if (string.len(pass) >= 4) then 
        local account = getAccount(user,pass) 
        if (account) then 
            outputChatBox("[!] Account: '"..user.."' exists  [!]", source, 255, 0, 0, true) 
        else 
            if addAccount( user, pass) then 
            outputChatBox("[!] Account: '"..user.."' | Password: '"..pass.."' [!]", source, 255, 0, 0, true) 
            else 
            outputChatBox("[!] Account cannot be registered [!]", source, 255, 0, 0) 
            end 
            else 
            outputChatBox("[!] Your password must be at least 4 characters long [!]", source, 255, 0, 0, true) 
            end 
        else 
            outputChatBox("[!] Password can not be blank [!]", source, 255, 0, 0, true) 
        end 
    else 
        outputChatBox("[!] Login can not be blank [!]", source, 255, 0, 0, true) 
    end 
end) 

Link to comment
Try this:
addEvent("Register",true) 
addEventHandler("Register",getRootElement(), 
    function (user,pass) 
    if user ~= "" then 
        if pass ~= "" then 
        if (string.len(pass) >= 4) then 
        local account = getAccount(user,pass) 
        if (account) then 
            outputChatBox("[!] Account: '"..user.."' exists  [!]", source, 255, 0, 0, true) 
        else 
            if addAccount( user, pass) then 
            outputChatBox("[!] Account: '"..user.."' | Password: '"..pass.."' [!]", source, 255, 0, 0, true) 
            else 
            outputChatBox("[!] Account cannot be registered [!]", source, 255, 0, 0) 
            end 
            else 
            outputChatBox("[!] Your password must be at least 4 characters long [!]", source, 255, 0, 0, true) 
            end 
        else 
            outputChatBox("[!] Password can not be blank [!]", source, 255, 0, 0, true) 
        end 
    else 
        outputChatBox("[!] Login can not be blank [!]", source, 255, 0, 0, true) 
    end 
end) 

This i don't must test i see this wrong. I mean i created account "TEST" password "TEST" if i created new account "test" with password "TEST" i see outputChatBox account is created but when i want log in it say account don't exists.

Link to comment
Seems like login is case sensitive, addAccount not.

Thats good, I don't want accounts Bonus, bonus, bonuS etc.

That's true as far as I've used the default account system. I would suggest you to transfer all the characters from the usernames to lowercase to avoid people with weird account names. This'll also fix the; I can create several accounts, but not login with them since they don't exist.

Link to comment
Seems like login is case sensitive, addAccount not.

Thats good, I don't want accounts Bonus, bonus, bonuS etc.

That's true as far as I've used the default account system. I would suggest you to transfer all the characters from the usernames to lowercase to avoid people with weird account names. This'll also fix the; I can create several accounts, but not login with them since they don't exist.

So how i can fix please?

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