aclGet | Multi Theft Auto: Wiki Skip to content

aclGet

Client-side
Server-side
Shared

Get the ACL with the given name. If need to get most of the ACL's, you should consider using aclList to get a table of them all.

OOP Syntax Help! I don't understand this!

  • Method: ACL.get(...)

Syntax

acl|false aclGet ( string aclName )
Required Arguments
  • aclName: The name to get the ACL belonging to.

Returns

  • acl|false: acl

Returns the ACL with that name if it could be retrieved, false/nil if the ACL does not exist or it fails for some other reason.

Code Examples

server

This example adds a command setaclright with which you can easily add new rights to specified access control lists.

local function setACLRight(thePlayer, commandName, aclName, rightName, access)
-- turn the boolean string to lower case
access = string.lower ( access )
-- access has to be either true or false (booleans)
if (access ~= "true" and access ~= "false") then
-- print out error message to debug window
return outputDebugString("Invalid access; true and false are only accepted", 1)
end
-- change the access to boolean
access = access == "true"
local ourACL = aclGet(aclName)
-- if there is no previous ACL with this name, we need to create one
if (not ourACL) then
ourACL = aclCreate(aclName)
end
-- and finally let's set the right
aclSetRight(ourACL, rightName, access)
-- don't forget to save the ACL after it has been modified
aclSave()
end
addCommandHandler("setaclright", setACLRight)