Jump to content
  • 0

Permissions


Benevolence

Question

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.

Link to comment

Recommended Posts

  • 0

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) 

Link to comment
  • 0
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?

Link to comment
  • 0
  • Discord Moderators

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.

Link to comment
  • 0
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.

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