- Documentation
- Server functions
- hasObjectPermissionTo
Function
hasObjectPermissionTo
Checks whether an object has a right. It first looks at the ACL lists of the object's groups; if none has an entry, the admins.xml levels decide, and finally the default value.
Syntax
bool hasObjectPermissionTo(mixed theObject, string theAction [, bool defaultPermission = true])Arguments
theObjectmixed- A player, resource or the string
"user.name". theActionstring- Right name, e.g.
"command.kick". defaultPermissionbool, optional = true- Result when there is no entry anywhere.
Returns
true if allowed.
Example
addCommandHandler("kick", function(player, cmd, name, ...)
if not hasObjectPermissionTo(player, "command.kick", false) then
outputChatBox("Brak uprawnień.", player, 255, 0, 0)
return
end
local target = name and getPlayerFromName(name)
if target then kickPlayer(target, player, table.concat({ ... }, " ")) end
end)