Jump to content

Antiinsult


Recommended Posts

It must be only for normal message.

Insults = { 
    -- Note: USE lowercase LETTERS 
    -- Format: { "Insult Word", "Replace Word" }, 
    { "bitch", "cow" }, 
} 
  
function chatL ( msg, msgType ) 
    if (not msgType == 0) then return end 
     
    for k,v in ipairs (Insults) do 
        if string.find( string.lower ( msg ),v[1]) then 
            msg = msg:gsub ( msg, v[2] ) 
        end 
    end 
    cancelEvent ( ) 
    outputChatBox(getPlayerName ( source )..": #ffffff"..msg,root,0,255,0,true) 
end 
addEventHandler( "onPlayerChat", getRootElement(), chatL ) 

Link to comment

Open fr_server.lua and replace this (at line 399):

addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
        if type == 0 then 
            cancelEvent() 
            local r, g, b = getPlayerNametagColor(source) 
            outputChatBox(getPlayerName(source) .. '#FFFFFF: #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
            outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) 
        end 
    end 
) 

For this:

Insults = { 
    -- Note: USE lowercase LETTERS 
    -- Format: { "Insult Word", "Replace Word" }, 
    { "bitch", "cow" }, 
} 
  
function chatL ( msg, msgType ) 
    if (not msgType == 0) then return end 
    
    for k,v in ipairs (Insults) do 
        if string.find( string.lower ( msg ),v[1]) then 
            msg = msg:gsub ( msg, v[2] ) 
        end 
    end 
    cancelEvent ( ) 
    outputChatBox(getPlayerName ( source )..": #ffffff"..msg,root,0,255,0,true) 
end 
addEventHandler( "onPlayerChat", getRootElement(), chatL ) 

Link to comment
still not working :(

Ok, try to delete at the line 399 in the freeroam file

Delete this:

addEventHandler('onPlayerChat', g_Root, 
    function(msg, type) 
        if type == 0 then 
            cancelEvent() 
            local r, g, b = getPlayerNametagColor(source) 
            outputChatBox(getPlayerName(source) .. '#FFFFFF: #FFFFFF' .. msg:gsub('#%x%x%x%x%x%x', ''), g_Root, r, g, b, true) 
            outputServerLog( "CHAT: " .. getPlayerName(source) .. ": " .. msg ) 
        end 
    end 
) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...