addEventHandler("onResourceStart", resourceRoot,
function ()
for index, player in pairs(getElementsByType("player")) do
bindKey ( player, "y","down", "chatbox", "Teamsay" )
end
end
)
addEventHandler("onPlayerJoin", root,
function ()
bindKey ( source, "y","down", "chatbox", "Teamsay" )
end
)
addCommandHandler("Teamsay",
function ( plr , cmd , ...)
if not isPlayerMuted(plr) then
local playerTeam = getPlayerTeam ( plr )
if ( playerTeam ) then
local r, g, b = getTeamColor ( playerTeam )
for _,v in ipairs ( getPlayersInTeam ( playerTeam ) ) do
outputChatBox('(TEAM)#FFFFFF '..colorHex(r, g, b)..''..getPlayerName(plr):gsub("#%x%x%x%x%x%x", "") ..': #FFFFFF'..table.concat({...},' '),v, r, g, b, true)
end
end
else
outputChatBox('Teamsay: You are muted!', plr, 50, 0, 100, true)
end
end)