Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- new word[6][20] = {"fuck", "shit", "bitch", "asshole", "fag", "faggot"};
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" word filter ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- SendPlayerMessageToAll(playerid, WordFilter(text));
- return 0;
- }
- stock WordFilter(const string[]){
- new newString[256];
- new bool:find[6] = {false, ...};
- format(newString, sizeof(newString), "%s", string);
- while(!find[0] || !find[1] || !find[2] || !find[3] || !find[4] || !find[5]){
- if(strfind(newString, word[0], true) == -1){
- find[0] = true;
- }else{
- //idx = strfind(newString, word[0], true);
- format(newString, sizeof(newString), "%s", replace(newString, word[0], "#$%!"));
- }
- if(strfind(newString, word[1], true) == -1){
- find[1] = true;
- }else{
- //idx = strfind(newString, word[1], true, idx);
- format(newString, sizeof(newString), "%s", replace(newString, word[1], "%@!$"));
- }
- if(strfind(newString, word[2], true) == -1){
- find[2] = true;
- }else{
- //idx = strfind(newString, word[2], true, idx);
- format(newString, sizeof(newString), "%s", replace(newString, word[2], "!&@#$"));
- }
- if(strfind(newString, word[3], true) == -1){
- find[3] = true;
- }else{
- //idx = strfind(newString, word[3], true, idx);
- format(newString, sizeof(newString), "%s", replace(newString, word[3], "!@#$%&"));
- }
- if(strfind(newString, word[4], true) == -1){
- find[4] = true;
- }else{
- //idx = strfind(newString, word[4], true, idx);
- format(newString, sizeof(newString), "%s", replace(newString, word[4], "&#@"));
- }
- if(strfind(newString, word[5], true) == -1){
- find[5] = true;
- }else{
- //idx = strfind(newString, word[5], true, idx);
- format(newString, sizeof(newString), "%s", replace(newString, word[5], "&%$#@!"));
- }
- }
- return newString;
- }
- stock replace(const string[], const target[], const replace[]){
- new useString[256];
- format(useString, sizeof(useString), "%s", string);
- if(strfind(string, target) != -1){
- new pos = strfind(useString, target);
- strdel(useString , pos, (strlen(target) + pos));
- strins(useString , replace, pos);
- }
- return useString;
- }
Advertisement
Add Comment
Please, Sign In to add comment