Jump to content

طلب فنكشات


XPro

Recommended Posts

60727218.png

اليوم اقدم لكم وظيفه getAdminsByGroup

هذه الوظيفة ترجع لك جدول بالأدمن وحالة وجودة

Server function

Syntax

table getAdminsByGroup( string Group ) 

Required Arguments

  • Group : اسم القروب المطلوب الحصول على الأدمنز منه

Returns

اذا كانت الأرقمنت المطلوبه صحيحه, يرجع لك جدول بكل الأدمنز مع اسمائهم اذا كانو موجودين واسماء حساباتهم اذا لم يكونو موجودين مع حالة تواجدهم بالسيرفر (اولاين)

Code

function getAdminsByGroup( Group ) 
    local users = {}; 
    for index, value in ipairs(aclGroupListObjects(aclGetGroup(Group))) do 
        if value:find("user.", 1, true) then 
            local accountname = value:sub(6, #value); 
            local OnlineStatus = getAccountPlayer(getAccount(accountname)) and true or false 
            table.insert(users, { 
                ["Name"] = OnlineStatus and getPlayerName(getAccountPlayer(getAccount(accountname))) or accountname, 
                ["Online"] = OnlineStatus and "Online" or "Offline" 
            }); 
        end 
    end 
    return users or false; 
end 

Example - Server Side

GroupsT = {"Console", "Admin"}; 
  
addCommandHandler("groups", 
function () 
    for i, group in ipairs(GroupsT) do 
        outputChatBox("~~> "..group.." :"); 
        local list = getAdminsByGroup(group); 
        for index=1, #list do 
            outputChatBox("* Name: "..list[index]["Name"].." ~~ Status: "..list[index]["Online"]); 
        end 
    end 
end ); 

Example Result

2ejtJEj.png

Author MoDeR2014

لا اعرف اذا كانت هذه الوظيفه موجودة من قبل ولكنني برمجتها للأخ White

لأنه كلمني عليها وقلت انشرها بنفس الوقت

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...