local allowedGroups = { "Admin" }
function isAllowed( player )
local acc = getPlayerAccount( player ) -- Check player's account
if isGuestAccount( acc ) or not acc then -- See if it's a guest account or it's returning false
return false -- Then return false
end -- End the if statment
local acc = getAccountName( acc ) -- Check player's account name
for i, v in ipairs( allowedGroups ) do -- Loop through table
if isObjectInACLGroup( "user."..acc, aclGetGroup( v ) ) then -- Check if he is in the group
return true
end
end
return false
end
function Announcement(thePlayer, commandName, ...)
local players = getElementsByType("player")
local playerName = getPlayerName ( thePlayer )
local chatContent = {...}
if isAllowed( thePlayer ) ~= true then
return
end
for index, player in ipairs ( players ) do
outputChatBox( "Announcement from " .. playerName.. ": " ..table.concat ( chatContent, " "), player, 255, 190, 105)
end
end
addCommandHandler( "ad", Announcement )
Explained ^