ABu-ALi_ Posted April 9, 2011 Share Posted April 9, 2011 hi all i try to make script bad words but not working this code server: function BadWords ( message, messageType ) if message == fuck then setPlayerMuted(source, true) outputChatBox ( getPlayerName ( source ).." has mute bad words", getRootElement(), 255, 255, 0, true ) end end addEventHandler ( "onPlayerChat", getRootElement(), BadWords ) if player say 'fuck' he will mute but this code not working please help me Link to comment
proracer Posted April 9, 2011 Share Posted April 9, 2011 function BadWords ( message, messageType ) if message == ':O' then setPlayerMuted(source, true) outputChatBox ( getPlayerName ( source ).." has mute bad words", getRootElement(), 255, 255, 0, true ) end end addEventHandler ( "onPlayerChat", getRootElement(), BadWords ) Link to comment
Cadu12 Posted April 9, 2011 Share Posted April 9, 2011 (edited) Bad = {":O", "fuck"} function BadWords ( message, messageType ) local Findingdots = string.gsub(message, "([%s%_%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])", '') for i, Findingbad in ipairs(Bad) do if string.find( message, Findingbad) then setPlayerMuted(source, true) outputChatBox ( getPlayerName ( source ).." has mute bad words", getRootElement(), 255, 255, 0, true ) elseif string.find( Findingdots, Findingbad) then setPlayerMuted(source, true) outputChatBox ( getPlayerName ( source ).." has mute bad words", getRootElement(), 255, 255, 0, true ) end end end addEventHandler ( "onPlayerChat", getRootElement(), BadWords ) Edited April 9, 2011 by Guest Link to comment
Moderators Citizen Posted April 9, 2011 Moderators Share Posted April 9, 2011 Bad = {":O", ":O"} function BadWords ( message, messageType ) local Findingdots = string.gsub(message, "([%s%_%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])", '') for i, Findingbad in ipairs(Bad) do if string.find( message, Findingbad) then setPlayerMuted(source, true) outputChatBox ( getPlayerName ( source ).." has mute bad words", getRootElement(), 255, 255, 0, true ) elseif string.find( Findingdots, Findingbad) then setPlayerMuted(source, true) outputChatBox ( getPlayerName ( source ).." has mute bad words", getRootElement(), 255, 255, 0, true ) end endendaddEventHandler ( "onPlayerChat", getRootElement(), BadWords ) [code]Epic fail ^^ but very nice code if it works Link to comment
ABu-ALi_ Posted April 10, 2011 Author Share Posted April 10, 2011 Thx For All i fix it Link to comment
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