Jump to content

Message to lower.


DjMixCuma

Recommended Posts

Posted

Hi!

I have trouble, because i added this to my code:

message:lower() 

and not working, and after i added:

string.lower(""..message.."") 

How to change letters in message to lower?

Posted (edited)

Well string.lower doesn't working with unicode. Also your variable message is string? Are you sure?

Check please via this function.

type 

Edited by Guest
Posted
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) 

Posted
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?

Posted

You should either store "lower" method's result in "message" again or use it directly in outputChatBox.

As already said, you're only calling a method which returns the string with lower characters, it doesn't store the new value in the variable.

Posted
    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) 

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