Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getOnlineAdmins()
- local t = {}
- for k,v in ipairs ( getElementsByType("player") ) do
- while true do
- local acc = getPlayerAccount(v)
- if not acc or isGuestAccount(acc) then break end
- local accName = getAccountName(acc)
- local isAdmin = isObjectInACLGroup("user."..accName,aclGetGroup("sms"))
- if isAdmin == true then
- table.insert(t,v)
- end
- break
- end
- end
- return t
- end
- function RGBToHex(red, green, blue, alpha)
- if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then
- return nil
- end
- if(alpha) then
- return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha)
- else
- return string.format("#%.2X%.2X%.2X", red,green,blue)
- end
- end
- function groupChat(plr, cmd, ...)
- if (plr) then
- local msg = table.concat({...}, " ")
- if (msg) then
- local plrGroup = getPlayerGroup(plr)
- for index, player in pairs(getElementsByType("player")) do
- local g2 = getPlayerGroup(player)
- if (plrGroup and g2 and g2 == plrGroup) then
- local team=getPlayerTeam(plr)
- local groupName=getElementData(plr,"Group")
- if team and groupName then
- local r,g,b=getTeamColor(team)
- if r and g and b then
- local hex=RGBToHex(r,g,b)
- if hex then
- outputChatBox(groupName.." -"..hex.." "..getPlayerName(plr)..": #FFFFFF"..msg, player, 255, 0, 0, true)
- end
- end
- end
- end
- local onlineAdmins = getOnlineAdmins()
- local groupName = getElementData(plr,"Group")
- for _,v in ipairs(onlineAdmins) do
- if v and groupName then
- local team=getPlayerTeam(plr)
- if team then
- local r,g,b=getTeamColor(team)
- if r and g and b then
- local hex=RGBToHex(r,g,b)
- if hex then
- outputChatBox(groupName.." -"..hex.." "..getPlayerName(plr)..": #ffffff"..msg,v,255,128,0,true)
- break
- end
- end
- end
- else
- outputDebugString("0 admins online",3)
- break
- end
- end
- end
- end
- end
- end
- addCommandHandler("gc", groupChat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement