Jump to content

Message to lower.


DjMixCuma

Recommended Posts

addEventHandler("onPlayerChat", getRootElement(), function(message, messageType) 
    for index, word in ipairs(bannedWords) do 
        if (message:find(word, 0)) then 
            tostring(message):lower() 
            outputChatBox("Player "..getPlayerName(source).." kicked! Reason: Bad Word!", root, 255, 255, 255, true) 
        end 
    end 
end) 

Link to comment
addEventHandler("onPlayerChat", getRootElement(), function(message, messageType) 
    for index, word in ipairs(bannedWords) do 
        if (message:find(word, 0)) then 
            tostring(message):lower() 
            outputChatBox("Player "..getPlayerName(source).." kicked! Reason: Bad Word!", root, 255, 255, 255, true) 
        end 
    end 
end) 

tostring(message):lower() 

What you are trying to do? You just convert variable message to lower string and doing nothing with result.

Also your variable 'bannedWords' is defined?

Link to comment
    addEventHandler("onPlayerChat", getRootElement(), function(message, messageType) 
        for index, word in ipairs(bannedWords) do 
            if (string.find(string.lower(message), word)) then 
                outputChatBox("Player "..getPlayerName(source).." kicked! Reason: Bad Word!", root, 255, 255, 255, true) 
            end 
        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...