ZH-CN/IsObjectInACLGroup

From Multi Theft Auto: Wiki
Revision as of 08:54, 5 February 2021 by Qwe7769611 (talk | contribs) (Created page with "__NOTOC__ {{Server function}} {{Important Note|You must '''NOT''' to use this function to limit features to users that belong to specific groups. Instead you '''MUST''' use...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

[[{{{image}}}|link=|]] Important Note: You must NOT to use this function to limit features to users that belong to specific groups. Instead you MUST use hasObjectPermissionTo. Using this function forces the server owner to name their group a certain way, whereas using hasObjectPermissionTo allows the owner to give permission for whatever features you restrict to whatever groups they have set up in their ACL.

This function is used to determine if an object is in a group.

Syntax

bool isObjectInACLGroup ( string theObject, aclgroup theGroup )

OOP Syntax Help! I don't understand this!

Method: aclgroup:doesContainObject(...)

Required Arguments

  • theObject: the name of the object to check. Examples: "resource.ctf", "user.Jim".
  • theGroup: the ACL group pointer of the group from which the object should be found.

Returns

Returns true if the object is in the specified group, false otherwise.

Example

Example 1: This example adds a jetpack command that is only available to admins. When entering the command, it will toggle the player's jetpack. <syntaxhighlight lang="lua"> addCommandHandler ( "jetpack",

   function ( thePlayer )
       if doesPedHaveJetPack ( thePlayer ) then -- If the player