Turbe$Z

Why not show online admins bottom left corner?

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

Share this post


Link to post
11 hours ago, Turbo777 said:

why not show online admins, when i join? how to fix?* :(

idk, its work on my server

Share this post


Link to post
5 hours ago, nikitafloy said:

idk, its work on my server

working, but when i join, the online admins not show.. :( how to fix?

  • Like 1

Share this post


Link to post
7 hours ago, Turbo777 said:

working, but when i join, the online admins not show.. :( how to fix?

because when u join - u not login
u must login and this will work.

Share this post


Link to post
2 minutes ago, nikitafloy said:

because when u join - u not login
u must login and this will work.

i know, but new players can not see :S

  • Like 1

Share this post


Link to post
6 minutes ago, Turbo777 said:

i know, but new players can not see :S

	triggerClientEvent(getResourceRootElement(), "setAdminList", getResourceRootElement(), admins)

 

Share this post


Link to post
12 hours ago, Turbo777 said:

i know, but new players can not see :S

Did you actually create another forum account just to like your own posts about "how to fix everything I download from community"? That's nice...

Share this post


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.