just something for yah to help with bad mouths
// ===================================== C H A T M U T E D E M O =====================================
// Minimal standalone example of a word-mute system.
// Add your muted words in the array below where indicated.
// Tracks muted players for the current session (optional; used here only to block repeated attempts)
local mutedPlayers = {}; // { playerID = true }
// List of banned/muted words. Case-insensitive match.
// Add here: "word1", "word2", "word3"
local bannedWords = [
// add here
];
// Helper to check if a message contains any banned word (case-insensitive, simple substring)
function ContainsBannedWord(message)
{
if(!message) return false;
local lower = message.tolower();
foreach(w in bannedWords){
if(typeof w == "string" && w != "" && lower.find(w.tolower()) != null){
return true;
}
}
return false;
}
// Optional: allow adding words dynamically at runtime via script API
function AddMutedWord(word)
{
if(!word || typeof word != "string") return false;
local lw = word.tolower();
foreach(w in bannedWords){ if(w.tolower() == lw) return false; }
bannedWords.append(word);
return true;
}
function onScriptLoad()
{
print("[MUTE-DEMO] Chat mute system loaded. Add words in bannedWords[] (mute_demo.nut).");
}
function onPlayerChat(player, text)
{
// Block if message contains a banned word
if(ContainsBannedWord(text))
{
mutedPlayers[player.ID] <- true; // session flag; adjust as needed
MessagePlayer("[#FF0000]Your message was blocked (contains a muted word).", player);
return 0; // prevent message from being sent
}
// If you want to block all chat from previously flagged players, uncomment below
// if(mutedPlayers.rawin(player.ID)) return 0;
return 1; // allow message
}