Jump to content

[HELP!] Moderator Function


Recommended Posts

Hello all,

I want to know how to maken an script work only with moderator so that the admin makes you can moderator and when you login with your moderator something pops up and then you can use it but so that normal players cant use it.

Is this possible to or cant this be done?

Greatings Frank

Link to post

for instance you could create commands with addCommandHandler() that only accepted special commands from only a certain account, using the getPlayerAccount(), that is you, the admin.....maybe?

I haven't looked into this so I don't if this is the best way to go, but it would work.

Link to post
Use the ACL. You can specify what users can access what console commands very easily.

The only trouble with that is the server ACL must have the commands in to block the user from using them for every game mode installed on the server. This is the reason I added my own account level checks to commands to make sure they wouldn't fire at all by normal users.

function playerInACLGroup(player,groupName) 
    local et = getElementType(player) 
  
    if (et == "player") or (et == "console") then 
        local account = getClientAccount(player) 
  
        if not isGuestAccount(account) then 
            local un    = "user." .. getAccountName(account) 
            local group = aclGetGroup (groupName) 
     
            for id, object in ipairs(aclGroupListObjects(group)) do 
                if object == un then 
                    return true 
                end 
            end 
        end 
    end 
  
    return false 
end 
  
function playerHasPower(player) 
  
    -- Return true if the player belongs to any of the priveledged users 
    for i,groupName in pairs({"Moderator","SuperModerator","Admin","Console"}) do 
        if playerInACLGroup(player,groupName) then 
            return true 
        end 
    end 
  
    return false 
end 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...