DjMixCuma Posted January 29, 2013 Posted January 29, 2013 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?
Kenix Posted January 29, 2013 Posted January 29, 2013 (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 January 29, 2013 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
DjMixCuma Posted January 29, 2013 Author Posted January 29, 2013 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)
Kenix Posted January 29, 2013 Posted January 29, 2013 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.
Anderl Posted January 29, 2013 Posted January 29, 2013 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
Kenix Posted January 29, 2013 Posted January 29, 2013 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.
Techial Posted January 29, 2013 Posted January 29, 2013 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/
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now