#Dv^ Posted March 5, 2017 Posted March 5, 2017 (edited) Hola, he estado tratando de hacer una especie de anti-spam para el chat, me funciona bien pero el problema está cuando se trata de mayúsculas o minúsculas. Por ejemplo: texts = {"asd","ASD") addEventHandler("onPlayerChat", root, function(msg, type) for _,_x in pairs(texts) do if string.find(msg,string.lower(_x)) then if type == 0 then cancelEvent() outputChatBox("Expulsado!") return end end end end ) Cuando en el chat escribo "asd" la condición se cumple, pero cuando escribo "AsD" la función o condición no se ejecuta, ¿Cómo hago para que detecte esta palabra sin importar mayúsculas/minúsculas? Agradezco la ayuda Edited March 5, 2017 by #Dv^
Arsilex Posted March 6, 2017 Posted March 6, 2017 local texts = {"asd") addEventHandler("onPlayerChat", root, function(msg, type) for _, text in pairs(texts) do if string.find(msg:lower(), text:lower()) then if type == 0 then cancelEvent() outputChatBox("Expulsado!") return end end end end) Deberia de funcionar
Recommended Posts