adrian enigma Posted May 10, 2019 Share Posted May 10, 2019 No caso quero mostrar quantos staffs estão online em 10 em 10 minutos e não fasso ideia Link to comment
Jonas^ Posted May 10, 2019 Share Posted May 10, 2019 (edited) Postou no local indevido. Na wiki tinha um exemplo basicamente pronto era só adaptar do seu gosto. Faça assim: local timerGetAdmins = 10 addEventHandler ("onResourceStart", resourceRoot, function () timerAdmins = setTimer (function () admins = "" for _, v in ipairs (getElementsByType ("player")) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then if isObjectInACLGroup ("user."..getAccountName (getPlayerAccount(v)), aclGetGroup ("Admin")) then if (admins == "") then admins = getPlayerName(v) else admins = admins .. ", " .. getPlayerName(v) end end end end outputChatBox ("Admins Online: #FFFFFF"..tostring(admins), root, 0, 233, 0, true) end, 60000 * timerGetAdmins, 0) end) @adrian enigma Edited May 10, 2019 by Jonas^ 1 Link to comment
DNL291 Posted May 12, 2019 Share Posted May 12, 2019 Tente isto (não testei) : local onlineStaff_minutes = 10 addEventHandler ("onResourceStart", resourceRoot, function () setTimer (function () local admins = {} for _, v in ipairs (getElementsByType ("player")) do if isPlayerStaff(v) then table.insert( admins, getPlayerName(v):gsub("#%x%x%x%x%x%x", "") ) end end outputChatBox ("Admins Online: #FFFFFF"..tostring(table.concat(admins, ", ")), root, 0, 233, 0, true) end, 60000 * onlineStaff_minutes, 0) end) -- https://wiki.multitheftauto.com/wiki/IsPlayerStaff local staffACLs = { aclGetGroup("Admin"), aclGetGroup("Moderator"), aclGetGroup("SuperModerator"), } function isPlayerStaff(p) local acc = getPlayerAccount(p) if not acc then return false end if isGuestAccount(acc) then return false end local object = getAccountName(acc) for _,group in ipairs(staffACLs) do if isObjectInACLGroup("user."..object,group) then return true end end return false end Link to comment
Jonas^ Posted May 12, 2019 Share Posted May 12, 2019 1 hour ago, adrian enigma said: não pego no caso Eu testei como não pegou? lembre-se são 10 minutos não 1 minuto, foi como você pediu. Link to comment
adrian enigma Posted May 12, 2019 Author Share Posted May 12, 2019 Gente acho que estou fazendo algo de errado estou fazendo de tudo para pegar Link to comment
Tommy. Posted May 12, 2019 Share Posted May 12, 2019 3 hours ago, adrian enigma said: Gente acho que estou fazendo algo de errado estou fazendo de tudo para pegar Você está colocando em server-side ? 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