Jump to content

Recommended Posts

Postou no local indevido.

Na wiki tinha um exemplo basicamente pronto era só adaptar do seu gosto.

Faça assim:

local timerGetAdmins = 10

addEventHandler ("onResourceStart", resourceRoot, function ()
	timerAdmins = setTimer (function ()
		admins = ""
		for _, v in ipairs (getElementsByType ("player")) do
			local accountname = ""
			if (isGuestAccount(getPlayerAccount(v)) == false) then
				if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount(v)), aclGetGroup ("Admin")) then
					if (admins == "") then
						admins = getPlayerName(v)
					else
						admins = admins .. ", " .. getPlayerName(v)
					end
				end
			end
		end
		outputChatBox ("Admins Online: #FFFFFF"..tostring(admins), root, 0, 233, 0, true)
	end, 60000 * timerGetAdmins, 0)
end)

@adrian enigma

Edited by Jonas^
  • Confused 1
Link to post

Tente isto (não testei) :


local onlineStaff_minutes = 10

addEventHandler ("onResourceStart", resourceRoot, function ()
	setTimer (function ()
	
		local admins = {}
		for _, v in ipairs (getElementsByType ("player")) do
			if isPlayerStaff(v) then
				table.insert( admins, getPlayerName(v):gsub("#%x%x%x%x%x%x", "") )
			end
		end
		
		outputChatBox ("Admins Online: #FFFFFF"..tostring(table.concat(admins, ", ")), root, 0, 233, 0, true)
		
	end, 60000 * onlineStaff_minutes, 0)
end)

-- https://wiki.multitheftauto.com/wiki/IsPlayerStaff
local staffACLs =
{
    aclGetGroup("Admin"),
    aclGetGroup("Moderator"),
    aclGetGroup("SuperModerator"),
}

function isPlayerStaff(p)
    local acc = getPlayerAccount(p)

    if not acc then return false end
    if isGuestAccount(acc) then return false end

    local object = getAccountName(acc)

    for _,group in ipairs(staffACLs) do
        if isObjectInACLGroup("user."..object,group) then
            return true
        end
    end
    return false
end

 

Link to post

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...