Jump to content

Antiinsult


Recommended Posts

Posted

Hello, it's me again...

I'm looking for an antiinsult script, i searched on community and forum, i found useless idea's and not working,

Like example if player say:

Fuck it write on chatbox Love

Bitch = lady

Gay = man

Etc

Can somebody help please and thanks.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Bump....

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

How?

Can you help me with a code?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Sure, show me the code.

Words = {"bitch", 
         "gay" 
         } 
  
  
    addEventHandler("onPlayerChat", getRootElement(), 
    function(msg, msgType) 
            for k,v in ipairs (Words) do 
    if string.find(msg,v) then 
                    cancelEvent() 
            pName = getPlayerName(source) 
            outputChatBox("INFO: #ffffff[#00ff00 Console#ffffff ]#ff0000 set mute to #ffff00"..pName.." ",getRootElement(),255,0,0,true) 
            setPlayerMuted(source, true) 
            setTimer (function (  ) 
            setPlayerMuted (source, false ) 
            end, 
            300000,1, source ) 
            end 
        end 
end 
) 

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

I don't want it to mute player, i want to replace the word by another one like example

Bitch replace with lady.

lua

local insults = { 
    "Fu ck" 
} 
  
local replace_sentence = { 
"Love", 
} 
  
local max_insult = 1000; 
local uebereinstimmungsrate = 4; 
local handle_type = 1; 
-- handle_type 1 = replaces the offense with a gay word 
-- handle_type 2 = kicks a user searches for "max_insult" from the server. 
-- handle_type 3 = recursively also sets up terms (not being completed) 
-- handle_type 4 = undertakes nothing 
  
addEventHandler("onPlayerChat", root, function(message, _type) 
    for index, val in pairs(insults) do 
        local new_val = val:lower(); 
        local message = message:lower(); 
        local match = false; 
         
        local laufwert = 0; 
        if message:len() > new_val:len() then 
            laufwert = new_val:len(); 
        elseif message:len() < new_val:len() then 
            laufwert = message:len(); 
        elseif message:len() == new_val:len() then 
            laufwert = new_val:len(); 
        end  
         
        if ( handle_type == 3 ) then 
            -- local currentLaufwert = 1; 
            -- local match = false; 
            -- local break_schleife = false; 
            -- laufwert = message:len(); 
            -- local inte_laufwert = 1; 
             
            -- local search_in_text_match = false 
            -- while ( inte_laufwert < laufwert+1 and search_in_text_match == false ) do 
                -- if ( string.byte(tostring(message), inte_laufwert) == string.byte(new_val) ) then 
                    -- search_in_text_match = true 
                    -- if inte_laufwert == 1 then 
                        -- outputDebugString("A"); 
                    -- end 
                -- end 
                -- inte_laufwert = inte_laufwert+1 
            -- end 
             
            -- if search_in_text_match then 
                -- while ( (currentLaufwert < laufwert+1) and ( break_schleife == false ) ) do 
                    -- if ( string.byte(tostring(message), currentLaufwert+inte_laufwert) ) then 
                         
                        -- if ( string.byte(tostring(message), currentLaufwert+inte_laufwert) ~= string.byte(tostring(new_val), currentLaufwert) ) then 
                            -- break_schleife = true 
                        -- else  
                            -- if ( currentLaufwert >= uebereinstimmungsrate ) then 
                                -- match = true 
                                -- break_schleife = true 
                            -- end 
                        -- end 
                         
                        -- currentLaufwert = currentLaufwert+1 
                    -- end 
                -- end 
            -- end 
        elseif ( handle_type == 2 ) then 
            local currentLaufwert = 1; 
            local break_schleife = false; 
            while ( (currentLaufwert < laufwert+1) and ( break_schleife == false ) ) do 
                if ( string.byte(tostring(message), currentLaufwert) ~= string.byte(tostring(new_val), currentLaufwert) ) then 
                    break_schleife = true 
                else  
                    if ( currentLaufwert >= uebereinstimmungsrate ) then 
                        match = true 
                        break_schleife = true 
                    end 
                end 
                 
                currentLaufwert = currentLaufwert+1 
            end 
             
            if ( match ) then 
                cancelEvent(); 
                handle_match(1); 
                break; 
            end 
             
        elseif ( handle_type == 1 ) then 
            local currentLaufwert = 1; 
            local break_schleife = false; 
            while ( (currentLaufwert < laufwert+1) and ( break_schleife == false ) ) do 
                if ( string.byte(tostring(message), currentLaufwert) ~= string.byte(tostring(new_val), currentLaufwert) ) then 
                    break_schleife = true 
                else  
                    if ( currentLaufwert >= uebereinstimmungsrate ) then 
                        match = true 
                        break_schleife = true 
                    end 
                end 
                 
                currentLaufwert = currentLaufwert+1 
            end 
         
            if ( match ) then 
                cancelEvent(); 
                handle_match(2); 
                break; 
            end 
        end 
             
         
         
    end 
end) 
  
function handle_match(_type) 
    if ( _type == 1 ) then 
        local oriVal = getElementData(source, "b_count") 
        if ( oriVal == false ) then 
            setElementData(source, "b_count", 1); 
            oriVal = 1; 
        else 
            oriVal = oriVal+1 
            setElementData(source, "b_count", oriVal) 
        end 
         
        if ( oriVal > max_insult ) then 
            kickPlayer(source, source, "Du hast die Grundregeln nicht beachtet!") 
        else 
            outputChatBox(string.format("Warnung %d: '%s' ist eine Beleidigung.\nWenn du drei mal auffällig geworden bist, wirst du gekickt.", oriVal, val), source, 255, 0, 0) 
        end 
    elseif ( _type == 2 ) then 
        local rand = math.random(1, #replace_sentence); 
        outputChatBox(string.format("%s\n#ff0011[libel action]", replace_sentence[rand]), root, 100, 100, 0, true); 
    end 
     
end 
  
addEventHandler("onResourceStop", root, function() 
    for index, ply in pairs(getElementsByType("player")) do  
        setElementData(ply, "b_count", 0); -- reset 
    end 
end) 
  
addEventHandler("onResourceStart", root, function() 
     
end) 

i tried this but wont work

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

okay thanks for helping.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Wait wait, try this i hope it'll work with you:

local pName = getPlayerName(source) 
  
addEventHandler("onPlayerChat", getRootElement(), 
function(msg, msgType) 
        if string.find(msg,"bitch") then 
           cancelEvent() 
           outputChatBox(pName..": Lady ",getRootElement(),255,0,0,true) 
        elseif string.find(msg,"gay") then 
           cancelEvent() 
           outputChatBox(pName..": Man ",getRootElement(),255,0,0,true) 
        end 
end 
) 

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

Wont work :(

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

It show nothing just some olds errors in freeroam.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted (edited)

Maybe it's from string.find, i'll find solution soon.

EDIT:

i solved it, hope it will works.

ladies = { 
    "bitch", 
} 
  
mans = { 
    "gay" 
}    
  
function chatL ( msg ) 
    for k,v in ipairs (ladies) do 
        if string.find(msg,v) then 
        cancelEvent( ) 
        local pn = getPlayerName (source) 
        outputChatBox(" " .. pn  .. "  : lady",0,255,0,true) 
        end 
    end 
end 
addEventHandler( "onPlayerChat", getRootElement(), chatL ) 
  
function chatM ( msg ) 
    for k,v in ipairs (mans) do 
        if string.find(msg,v) then 
        cancelEvent( ) 
        local pn = getPlayerName (source) 
        outputChatBox(" " .. pn  .. "  : man",0,255,0,true) 
        end 
    end 
end 
addEventHandler( "onPlayerChat", getRootElement(), chatM ) 

Edited by Guest

To Visit Us

Press Here: mtasa://5.9.206.180:22002

b648040241b8f01.png

0d0a7bb38ca13e5.png

Posted

ok

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Anything else?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
Anything else?
Insults = { 
    ['shit'] = 'caca', 
    ['fuck'] = 'love', 
    ['bitch'] = 'miss', 
    ['gay'] = 'nice man' 
} 
  
  
addEventHandler("onPlayerChat", getRootElement(), 
function(message, type) 
    if message and (type == 0) then 
        for i, w in pairs(Insults)do 
            if string.find(message, i) then 
                cancelEvent() 
                local message = string.gsub(message, i, w) 
                outputChatBox(getPlayerName(source)..":#FFFFFF "..message, getRootElement(), 255, 255, 255, true) 
            end 
        end  
    end 
end) 

Paid developer. Twitter: @willia_am -

http://www.williamdasilva.fr
Posted

Gonna try :)

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

(If FatalTerror's code dosn't work)

You can try this, although i havn't tested it.

Insults = { 
    -- Note: USE lowercase LETTERS 
    -- Format: { "Insult Word", "Replace Word" }, 
    { "bitch", "cow" }, 
} 
  
function chatL ( msg ) 
    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 ) 

Posted
(If FatalTerror's code dosn't work)

You can try this, although i havn't tested it.

Insults = { 
    -- Note: USE lowercase LETTERS 
    -- Format: { "Insult Word", "Replace Word" }, 
    { "bitch", "cow" }, 
} 
  
function chatL ( msg ) 
    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 ) 

Working but keep repeating my message like player colos like example

Steven: Bitch

Steven: Cow

It write like that.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Can you explain me how?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Youre right i turn it off and it worked but i'm using freeroam.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

You can remove the chat part from it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...