Jump to content
  • 0

Permissions


Benevolence

Question

Posted

Alright so I have a Roleplay server and you don't register by /register like you do in default server that comes when you install MTA. I wanted to know, how I can create an account like the default server lets you so that you can make it admin and add resources to acl only if your logged in with that account. I use mySQL.

Because I try adding some resources and when I try to use them it tells me "You don't have permission to use ... " and I can't seem to get around this, I tried some stuff in acl.xml file (probly not correct) but it keeps telling me that.

Can other people connect to your server? Use this tool to check:

http://nightly.mtasa.com/ports/

1484762903.png

Formerly known as Tank07.

Recommended Posts

  • 0
Posted

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) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

  • 0
Posted
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?

Can other people connect to your server? Use this tool to check:

http://nightly.mtasa.com/ports/

1484762903.png

Formerly known as Tank07.

  • 0
  • Moderators
Posted

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.

  • 0
Posted
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.

Can other people connect to your server? Use this tool to check:

http://nightly.mtasa.com/ports/

1484762903.png

Formerly known as Tank07.

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