X
---------
جرب,
local teamName = "" -- إسم التيم
local key = "" -- المفتاح
addCommandHandler ( "teamChat",
function ( player, _, ... )
local msg = table.concat ( { ... }, " " );
local playerName = getPlayerName ( player );
local playerTeam = getPlayerTeam ( player );
if playerTeam and teamName then
local r, g, b = getTeamColor ( playerTeam );
for _, players in ipairs ( getElementsByType ( "player" ) ) do
if playerTeam == teamName then
outputChatBox ( "(" .. teamName .. ") " .. playerName .. ": #FFFFFF" .. msg, players, r, g, b, true );
end
end
end
end
);
addEventHandler ( "onResourceStart", resourceRoot,
function ( )
for _, players in ipairs ( getElementsByType ( "player" ) ) do
bindKey ( players, key, "down", "chatBox", "teamChat" );
end
end
);
addEventHandler ( "onPlayerJoin", root,
function ( )
bindKey ( source, key, "down", "chatBox", "teamChat" );
end
);