AR/aclGetGroup: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "==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 'pla...")
 
Line 16: Line 16:
===مثال===
===مثال===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- لايوجد مثال
 
players = getElementsByType ( "player" )
admins = ""
for k,v in ipairs(players) do
  local accountname = ""
  if (isGuestAccount(getPlayerAccount(v)) == false) then
      accountname = getAccountName (getPlayerAccount(v))
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then
        if (admins == "") then
            admins = getPlayerName(v)
        else
            admins = admins .. ", " .. getPlayerName(v)
        end
      end
  end
end
outputChatBox( "Online Admins:", getRootElement(), 255, 255, 0)
outputChatBox( " " .. tostring ( admins ), getRootElement(), 255, 255, 0)
 
</syntaxhighlight>
</syntaxhighlight>

Revision as of 15:51, 7 April 2013

Syntax

aclgroup aclGetGroup ( string groupName )

العناصر المطلوبة

  • groupName: اسم القروب ( المجموعة ) التي تريد احضارها


Returns

Returns اذا تم العثور على القروب. الرجوع اليه false/nil اذا لم يوجد القروب او فشل بسبب غير معروف.

مثال


players = getElementsByType ( "player" )
admins = ""
for k,v in ipairs(players) do
   local accountname = ""
   if (isGuestAccount(getPlayerAccount(v)) == false) then
      accountname = getAccountName (getPlayerAccount(v))
      if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then
         if (admins == "") then
            admins = getPlayerName(v)
         else
            admins = admins .. ", " .. getPlayerName(v)
         end
      end
   end
end
outputChatBox( "Online Admins:", getRootElement(), 255, 255, 0)
outputChatBox( " " .. tostring ( admins ), getRootElement(), 255, 255, 0)