Jump to content

Why not show online admins bottom left corner?


Turbe$Z

Recommended Posts

Client.lua : 

LblOnlineAdmins = {}
admins = ""

function setAdminList(list)
	if (admins ~= list) then
		admins = list
		if (admins == "") then
			guiSetText(LblOnlineAdmins, "Admins online: none")
		else
			guiSetText(LblOnlineAdmins, "Admins online: " .. admins)
		end
	end
end

addEvent( "setAdminList", true )
addEventHandler( "setAdminList", getRootElement(), setAdminList )

function getAdmins()
	LblOnlineAdmins = guiCreateLabel(0,0.9466,0.3799,0.0247,"",true)
	guiLabelSetColor(LblOnlineAdmins,255,0,0)
	guiLabelSetVerticalAlign(LblOnlineAdmins,"top")
	guiLabelSetHorizontalAlign(LblOnlineAdmins,"left",true)
	guiSetFont(LblOnlineAdmins,"default-bold-small")
end

addEventHandler( "onClientResourceStart", getRootElement( ), getAdmins)

Server.lua : 

admins = ""

function processAdminList()
	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
	triggerClientEvent("setAdminList", getResourceRootElement(), admins)
end

addEventHandler( "onPlayerLogin", getRootElement(), processAdminList )
addEventHandler( "onPlayerLogout", getRootElement(), processAdminList )
addEventHandler( "onPlayerChangeNick", getRootElement(), processAdminList )
addEventHandler( "onPlayerQuit", getRootElement(), processAdminList )
addEventHandler("onPlayerJoin", getRootElement(), processAdminList)

how to fix?:(

  • Like 1
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...