avertuss 48 Posted May 8, 2019 Share Posted May 8, 2019 Hi. How can i edit chat like: if player sent message "hi noob" it will be shown "hi n**b". I know that i should use if idkwhat.find("noob") != -1: idkwhat = idkwhat.replace('noob', 'n**b') but idk where should i use that in uichat or idk where. Any ideas? Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10242 Posted May 8, 2019 Forum Moderator Share Posted May 8, 2019 root/uiChat.py def __SendChatPacket(self, text, type): root/uiWhisper.py def SendWhisper(self): Change variable idkwhat with text. 3 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Kori 170 Posted May 9, 2019 Share Posted May 9, 2019 16 hours ago, avertuss said: Hi. How can i edit chat like: if player sent message "hi noob" it will be shown "hi n**b". I know that i should use if idkwhat.find("noob") != -1: idkwhat = idkwhat.replace('noob', 'n**b') but idk where should i use that in uichat or idk where. Any ideas? Make a array like here : Words = ["noob", "l33t", "ggwp"] for v in Words: if text.find(v) != -1: BWords = text.replace(v, '****') 1 Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10242 Posted May 9, 2019 Forum Moderator Share Posted May 9, 2019 4 hours ago, Kori said: BWords = text.replace(v, '****') #text = text.replace(word, word[0] + "*" * (len(word) - 2) + word[-1]) text = text.replace(word, '{first}{filter_char}{last}'.format( first = word[0], filter_char = "*" * (len(word) - 2), last = word[-1])) >>> Don't call me a l******y. With that type of replace you'll get asterisks by the length of your specific word, and will show just the first and the last character. @avertuss Btw you already have CInsultChecker::FilterInsult (which is used just for server-2-client TPacketGCChat), you can modify/duplicate the functions which are related about it and return the specific string which is detected from sentence and replace it with that method in python. Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Kori 170 Posted May 9, 2019 Share Posted May 9, 2019 1 hour ago, VegaS™ said: #text = text.replace(word, word[0] + "*" * (len(word) - 2) + word[-1]) text = text.replace(word, '{first}{filter_char}{last}'.format( first = word[0], filter_char = "*" * (len(word) - 2), last = word[-1])) >>> Don't call me a l******y. With that type of replace you'll get asterisks by the length of your specific word, and will show just the first and the last character. @avertuss Btw you already have CInsultChecker::FilterInsult (which is used just for server-2-client TPacketGCChat), you can modify/duplicate the functions which are related about it and return the specific string which is detected from sentence and replace it with that method in python. Good code, yes I have typed my code on mobile phone Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now