AclCreateGroup: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
{{Server function}}
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function creates a group in the ACL. An ACL group can contain objects like players and resources. They specify who has access to the ACL's in this group.


==Syntax==  
==Syntax==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
aclgroup aclCreateGroup ( string groupname )
aclgroup aclCreateGroup ( string groupName )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[aclgroup|ACLGroup]]||}}
===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''groupName:''' The name of the group to create
*'''argumentName:''' description
 
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns the pointer to the created aclgroup if successful. Returns false if failed.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example adds a command ''addobjecttogroup'' with which you can easily add new objects to specified access control list groups.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function addACLGroupObject ( thePlayer, commandName, groupName, objectName )
blabhalbalhb --abababa
    local ourGroup = aclGetGroup ( groupName )
--This line does this...
    -- if there is no previous group with this name, we need to create one
mooo
    if not ourGroup then
        ourGroup = aclCreateGroup ( groupName )
    end
 
    -- if object name wasn't given
    if not objectName then
        -- print out message to chatbox
        return outputChatBox ( "You need to specify the object!", thePlayer )
    end
 
    -- and finally let's add the object to it's group
    aclGroupAddObject ( ourGroup, objectName )
    -- don't forget to save the ACL after it has been modified
    aclSave ()
end
addCommandHandler ( "addobjecttogroup", addACLGroupObject )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{ACL_functions}}
{{ACL_functions}}
[[Category:Incomplete]]
 
[[ar:aclCreateGroup]]
[[en:aclCreateGroup]]
[[zh-cn:AclCreateGroup]]

Latest revision as of 18:08, 21 February 2021

This function creates a group in the ACL. An ACL group can contain objects like players and resources. They specify who has access to the ACL's in this group.

Syntax

aclgroup aclCreateGroup ( string groupName )

OOP Syntax Help! I don't understand this!

Method: ACLGroup(...)


Required Arguments

  • groupName: The name of the group to create

Returns

Returns the pointer to the created aclgroup if successful. Returns false if failed.

Example

This example adds a command addobjecttogroup with which you can easily add new objects to specified access control list groups.

function addACLGroupObject ( thePlayer, commandName, groupName, objectName )
    local ourGroup = aclGetGroup ( groupName )
    -- if there is no previous group with this name, we need to create one
    if not ourGroup then
        ourGroup = aclCreateGroup ( groupName )
    end

    -- if object name wasn't given
    if not objectName then
        -- print out message to chatbox
        return outputChatBox ( "You need to specify the object!", thePlayer )
    end

    -- and finally let's add the object to it's group
    aclGroupAddObject ( ourGroup, objectName )
    -- don't forget to save the ACL after it has been modified
    aclSave ()
end
addCommandHandler ( "addobjecttogroup", addACLGroupObject )

See Also