Sign in to follow this  
Benevolence

Permissions

Recommended Posts

What happens exactly?

If nothing happens then the account already exists.

No I tried a couple times. Also, when i type only /register it doesn't even say a SYNTAX msg.

Share this post


Link to post

Lol, because there is no code, for SYNTAX message.

addCommandHandler("register", 
function(player, cmd, name, password) 
if not name or not password then outputChatBox ( "SYNTAX: /register " , player ) return end 
local account = addAccount(name, password) 
if account then 
outputChatBox("Thank you " .. getPlayerName(player) .. ", you're now registed, you can login with /login",player) 
else 
outputChatBox("The account already exists" , player ) 
end 
end) 

Share this post


Link to post
Lol, because there is no code, for SYNTAX message.
addCommandHandler("register", 
function(player, cmd, name, password) 
if not name or not password then outputChatBox ( "SYNTAX: /register " , player ) return end 
local account = addAccount(name, password) 
if account then 
outputChatBox("Thank you " .. getPlayerName(player) .. ", you're now registed, you can login with /login",player) 
else 
outputChatBox("The account already exists" , player ) 
end 
end) 

It works. One question, if I forget my info for this, how can I find it? Like if I forget my password. Where does the info save?

Share this post


Link to post

If you mean, how to retrieve the password, you can do it with setAccountData(account, "password", password).

And then use getAccountData.

Share this post


Link to post
If you mean, how to retrieve the password, you can do it with setAccountData(account, "password", password).

And then use getAccountData.

And how can I see which accounts exist?

Share this post


Link to post

You mean checking if an account exists?

if getAccount ( "accountName" ) then 

Share this post


Link to post
You mean checking if an account exists?
if getAccount ( "accountName" ) then 

No, I want to see all of the accounts that already exist. Perhaps if I want to do a wipe or remove a certain account.

Share this post


Link to post

For wiping all accounts?

for i,account in ipairs(getAccounts()) do 
    removeAccount (account) 
end 

I suppose if you want to remove an account by name:

function removeAccountByName (strName, bPrtName) 
    if not strName or (type(strName) ~= 'string') then return end 
  
    for i,account in ipairs(getAccounts()) do 
        local accountName = getAccountName (account) 
     
        if (not bPrtName) then 
            if not (accountName:lower() == strName:lower()) then 
                return 
            end 
             
            removeAccount (account) 
            return 
        end 
         
        if accountName:find(strName, 0, true) then 
            removeAccount(account) 
        end 
    end 
end 

bPrtName is a boolean specifying whether to search for an account name containing the given string, or whether it has to be matching.

Share this post


Link to post
For wiping all accounts?
for i,account in ipairs(getAccounts()) do 
    removeAccount (account) 
end 

I suppose if you want to remove an account by name:

function removeAccountByName (strName, bPrtName) 
    if not strName or (type(strName) ~= 'string') then return end 
  
    for i,account in ipairs(getAccounts()) do 
        local accountName = getAccountName (account) 
     
        if (not bPrtName) then 
            if not (accountName:lower() == strName:lower()) then 
                return 
            end 
             
            removeAccount (account) 
            return 
        end 
         
        if accountName:find(strName, 0, true) then 
            removeAccount(account) 
        end 
    end 
end 

bPrtName is a boolean specifying whether to search for an account name containing the given string, or whether it has to be matching.

Can you give me the proper Meta.xml for it? Thanks.

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.