addEventHandler('onPlayerChat', root,
function(msg, type)
-- blank message patch
local firstCharacter = string.sub(msg, 1, 1)
if ( string.byte(firstCharacter) == 32 ) then
outputChatBox( "Invalid text input." )
return
end
if type == 0 then
cancelEvent()
if not hasObjectPermissionTo(source, "command.kick") and not hasObjectPermissionTo(source, "command.mute") then
if chatTime[source] and chatTime[source] + tonumber(get("*chat/mainChatDelay")) > getTickCount() then
outputChatBox("Stop spamming main chat!", source, 255, 0, 0)
return
else
chatTime[source] = getTickCount()
end
if get("*chat/blockRepeatMessages") == "true" and lastChatMessage[source] and lastChatMessage[source] == msg then
outputChatBox("Stop repeating yourself!", source, 255, 0, 0)
return
else
lastChatMessage[source] = msg
end
end
if isElement(source) then
local r, g, b = getPlayerNametagColor(source)
outputChatBox(getPlayerName(source) .. ': #FFFFFF' .. stripHex(msg), root, r, g, b, true)
outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg )
end
end
end
)