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

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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?

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

DjMixCuma, I guess you are don't understand what you are doing. I give you advise, you need learn lua.

http://vk.com/the_kenix

Вопросы задавайте на форуме, не пишите мне в личку.

Please don't pm me.

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) 

____________________________________________________________

http://techial.net/

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