Hey! I have a chat script, I want to make it so if a player is muted, then he cant use it... I've tried adding if not isPlayerMuted (thePlayer) stuff, but it doesnt work...
Code:
local isChatDisabled = {}
function globalMessage(thePlayer, cmd, ...)
local message = table.concat ( { ... }, " " );
local name = getPlayerName(thePlayer);
for _,v in ipairs(getElementsByType("player")) do
if not isChatDisabled[v] then
outputChatBox("#FF0000[GLOBAL]#00FF00"..name..": #FFFFFF"..message,v, 255, 255, 255, true)
end
end
end
addCommandHandler("global", globalMessage);
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),
function()
for index,player in pairs(getElementsByType("player")) do
bindKey(player,"b", "down", "chatbox", "global");
end
end
)
addEventHandler("onPlayerJoin",root,
function ()
bindKey(source,"b", "down", "chatbox", "global");
end
);
addCommandHandler("gcoff",
function(p)
isChatDisabled[p] = true;
end );
addCommandHandler("gcon",
function(p)
isChatDisabled[p] = false;
end );