Jump to content

Can't add account [Solved]


Newbie

Recommended Posts

outputChatBox("Error creating account, contact the server admin.",source)

Client

addEventHandler("onClientGUIClick", root, 
function (button, state) 
    if button == "left" and state == "up" then 
    if (source == buttonHover) then 
    username = exports.dxEditBox:getText( "1" ) 
    password = exports.dxEditBox:getText( "2" ) 
    triggerServerEvent("register1", localPlayer, username, password) 
    outputChatBox("Username: ".. username .." Password: " .. password .."",255,255,255,true) 
end 
end 
end) 
  

Server

function registerr( username, password ) 
if(password ~= "" and password ~= nil and username ~= "" and username ~= nil) then 
                local accountAdded = addAccount(username,password) 
                if(accountAdded) then 
                        outputChatBox("Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login",source) 
                else 
                        outputChatBox("Error creating account, contact the server admin.",source) 
                end 
        else 
                outputChatBox("Error creating account, correct syntax: /register ",source) 
        end 
end 
addEvent( "register1", true ) 
addEventHandler( "register1", root, registerr ) 
  

Link to comment
function registerr( username, password ) 
    if not ( username == "")  and ( not password == "" )  then 
        local accountAdded = addAccount(username,password) 
        if(accountAdded) then 
        outputChatBox("Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login",source) 
        else 
        outputChatBox("Error creating account, contact the server admin.",source) 
        end 
    else 
    outputChatBox("Error creating account, correct syntax: /register ",source) 
    end 
end 
addEvent( "register1", true ) 
addEventHandler( "register1", root, registerr ) 
  

EDIT: check if this code gives you the text needed;

 username = exports.dxEditBox:getText( "1" ) 
password = exports.dxEditBox:getText( "2" ) 
outputChatBox("name: "..username.. " | pass: "..password) 

Link to comment

I'll already did it by other way.

It adds account!

function registerr ( username, password ) 
    if ( username and password and type ( username ) == 'string' and type ( password ) == 'string' ) then 
    account = addAccount ( username, password ) 
    exports.bar_messages:outputMessageBar("Successfully signed up! Now you can play", source, 0, 0, 0, 5000) 
    end 
end 
addEvent( "register1", true ) 
addEventHandler( "register1", root, registerr ) 

How can i make that when player click's register button "as shown upper" to check if account already exists ?

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