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 Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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. Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
Evil-Cod3r Posted February 17, 2012 Posted February 17, 2012 Nice Tutorial Man Keeb it Going My in-game nick is |['Dev-PoinT_SA']| addEventHandler ( "onPlayerSpawn", getRootElement(), function() if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then triggerClientEvent("BlaBlaBla",getRootElement()) DxDrawText("Hi Dev-PoinT") end end)
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... Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
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". Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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. Tutorials: => getOnlineAdmins() => [TUT] Better Join Country => [TUT] Updating admin countries => [TUT] Updating admin flags Server: K@N Zombies / Freeroam
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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Kenix Posted February 19, 2012 Posted February 19, 2012 Offtopic: See functions/classes viewtopic.php?f=141&t=33091 http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Om. Posted November 3, 2014 Posted November 3, 2014 Thank you for this nyc tutorial, i'm learning lua, helped me alot! Looking for a developer? Feel free to PM me
Recommended Posts