codeluaeveryday Posted February 16, 2012 Posted February 16, 2012 (edited) Hey all, i've created a function which gets all online admins. Source: function getOnlineAdmins() count = 0 online = "" for i, v in ipairs(getElementsByType("player")) do if hasObjectPermissionTo(v,"function.setPlayerMuted",true) then online = getPlayerName(v).." "..online count = count+1 end end return online, count end Returns: A string of admins, spaced out. Example: function getOnlineAdmins() count = 0 online = "" for i, v in ipairs(getElementsByType("player")) do if hasObjectPermissionTo(v,"function.setPlayerMuted",true) then online = getPlayerName(v).." "..online count = count+1 end end return online, count end addCommandHandler("test", function() local online, count = getOnlineAdmins() outputChatBox("ONLINE: ("..count..") "..online) end ) This will say in chatbox if one admin in online aka me.. ONLINE: 1 csmit195. I hope you enjoy my source code. Take a look at my new admins resource. https://community.multitheftauto.com/index.php?p= ... ls&id=3800 Edited February 17, 2012 by Guest
12p Posted February 16, 2012 Posted February 16, 2012 If you want the online ADMINS, I would suggest to check for the "command.ban" permission. Because this code applies to mods, smods and admins.
Castillo Posted February 16, 2012 Posted February 16, 2012 I suggest you to add it to "Useful functions" page at the wiki: https://wiki.multitheftauto.com/wiki/Useful_Functions
codeluaeveryday Posted February 17, 2012 Author Posted February 17, 2012 Cool. @Castillo. How do I create a new wiki page... I've looked and looked... I would love this in the useful functions. First ill add more features. @Ben, my script was meant to be returning all admins/mods/smods.
mjau Posted February 18, 2012 Posted February 18, 2012 csmit in right top corner of wiki it says login with openID try that
12p Posted February 18, 2012 Posted February 18, 2012 @Ben, my script was meant to be returning all admins/mods/smods. In that case, getOnlineStaffMembers() would make more sense.
codeluaeveryday Posted February 19, 2012 Author Posted February 19, 2012 Yeah im logged in easy that. I know alot about openid, but i am having issues finding the new page option...
JR10 Posted February 19, 2012 Posted February 19, 2012 Just type in search the new page title and click search, if it exists it will show you the page's link, if it doesn't, it will show you "Create this page".
codeluaeveryday Posted February 19, 2012 Author Posted February 19, 2012 Thanks. Done it: https://wiki.multitheftauto.com/wiki/GetOnlineStaff Please let me know if i need to improve it.
Castillo Posted February 19, 2012 Posted February 19, 2012 My opinion is that it should return a table with every group and their group members.
Kenix Posted February 19, 2012 Posted February 19, 2012 Offtopic: See functions/classes viewtopic.php?f=141&t=33091
Om. Posted November 3, 2014 Posted November 3, 2014 Thank you for this nyc tutorial, i'm learning lua, helped me alot!
Recommended Posts