AR/aclGet: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} تقوم هذه الوظيفة بجلب الأسل من خلال إسمه . ==تركيب الجملة :== <syntaxhighlight lang="lua"> acl ac...")
 
No edit summary
Line 12: Line 12:


===المعطيات :===
===المعطيات :===
. إذا كانت أحد الفراغات المطلوبة خاطئة false \ nil تقوم بإعطائك الأسل إذا كانت المطاليب صحيحة , و تعطيك  
. إذا كانت أحد الفراغات المطلوبة خاطئة '''false''' \ '''nil''' تقوم بإعطائك الأسل إذا كانت المطاليب صحيحة , و تعطيك  
== أمثلة :==  
== أمثلة :==  
This example adds a command ''setaclright'' with which you can easily add new rights to specified access control lists.
This example adds a command ''setaclright'' with which you can easily add new rights to specified access control lists.
Line 46: Line 46:
</syntaxhighlight>
</syntaxhighlight>


تمت الإضافة و الترجمة من قبل : ^iiEcoo'x_)
تمت الإضافة و الترجمة من قبل : '''^iiEcoo'x_)'''
==See Also==
==See Also==
{{ACL_functions}}
{{ACL_functions}}

Revision as of 14:22, 27 April 2020

تقوم هذه الوظيفة بجلب الأسل من خلال إسمه .

تركيب الجملة :

acl aclGet ( string aclName )

الفراغات المطلوبة :

  • aclName: إسم الأسل المطلوب جلبه .

المعطيات :

. إذا كانت أحد الفراغات المطلوبة خاطئة false \ nil تقوم بإعطائك الأسل إذا كانت المطاليب صحيحة , و تعطيك

أمثلة :

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

function setACLRight ( thePlayer, commandName, aclName, rightName, access )
    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

    -- turn the boolean string to lower case
    access = string.lower ( access )
    -- access has to be either true or false (booleans)
    if not (access == "true" or 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
    if access == "true" then
        access = true
    else 
        access = false
    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 )

تمت الإضافة و الترجمة من قبل : ^iiEcoo'x_)

See Also