LucasBaker Posted June 16, 2013 Share Posted June 16, 2013 Well I'm trying to create a script with the following function one player enters such a bitch and instead of leaving that word out another eg Censored just that I do not know what it could someone teach me what I use? Link to comment
LucasBaker Posted June 16, 2013 Author Share Posted June 16, 2013 function antOfensa () x = string.gsub("bitch", "%w+", "%0 %0", 1) --> x="I Love You" end ? Link to comment
Wei Posted June 16, 2013 Share Posted June 16, 2013 function antOfensa () x = string.gsub("bitch", "bitch","I Love You") --string.gsub(text, selectedWord, wordToReplace) --> x="I Love You" end Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 What you mean by i could not? And you want it in the chat box? Link to comment
LucasBaker Posted June 17, 2013 Author Share Posted June 17, 2013 What you mean by i could not? And you want it in the chat box? Yes when a player enter appear bitch i love you Link to comment
iPrestege Posted June 17, 2013 Share Posted June 17, 2013 Make sure it's a server side and if there's any problem use debug . local aTable = { -- ['Word'] = { 'Out put of it' }, ['bitch'] = { 'I Love You' }, } addEventHandler('onPlayerChat',root, function ( Massege ) local r,g,b = getPlayerNametagColor ( source ) or 255,255,255 for v in pairs ( aTable ) do if string.find ( Massege,v ) then cancelEvent ( ) outputChatBox ( ' '..getPlayerName ( source )..' : '..aTable [ v ] [ 1 ]..' ',root,r,g,b ) end end end ) 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