kevin11 Posted June 6, 2010 Share Posted June 6, 2010 i basicly got this from wiki and i dont know how to change it so it only outputs admins names it now shows all my acl's function printOnlineAdmins ( thePlayer ) local allAdmins = aclList() if #allAdmins == 0 then return outputChatBox( "No admins online", getRootElement(), 255, 255, 0) else outputChatBox( "Online Admins:", getRootElement(), 255, 255, 0) for key, singleACL in ipairs ( allAdmins ) do local ACLName = aclGetName ( singleACL ) outputChatBox( "- " .. tostring ( ACLName ), getRootElement(), 255, 255, 0) end end end addCommandHandler ( "admins", printOnlineAdmins ) Link to comment
Castillo Posted June 6, 2010 Share Posted June 6, 2010 here is done and working admins.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 outputChatBox( "Online Admins:", getRootElement(), 255, 255, 0) outputChatBox( " " .. tostring ( admins ), getRootElement(), 255, 255, 0) end addEvent("admins", true) addEventHandler( "admins",getRootElement(), processAdminList ) --addCommandHandler ( "admins", processAdminList ) function checkCommand ( message, messageType ) if ( messageType == 0 ) then if ( message == "!admins" ) then setTimer( triggerEvent, 100, 1, "admins", source ) end end end addEventHandler ( "onPlayerChat", getRootElement(), checkCommand ) meta.xml <meta> <info name="online admins" author="Castillo" version="1.0" type="script" /> <script src="admins.lua" type="server"/> meta> Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now