Little help :s
#1

I have a function DisableBadWord found in a thread in filter script section.
If I have under OnPlayerText DisableBadWord("fuck"); and a player types fuck it will send ****
But I have a var to store words but when he types a word that is in that var it doesn't send ****
It sends the word
Why?
pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new j = 0; j < ForbidenWordsLoaded; j++)
    {
        DisableBadword(ForbidenWords[j]);
    }
    return 1;
}
pawn Код:
function LoadForbidenWords()
{
    new File:handle = fopen("FAdmin/Logs/Forbidenwords.txt", io_read),word[32],i = 0;
    while(fread(handle, word))
    {
        if(i >= sizeof(ForbidenWords))
        {
            printf("Warning: Could not load more than %d words. Destination array is too small!",sizeof(ForbidenWords));
            break;
        }
        strcpy(ForbidenWords[i], word);
        printf("%s",ForbidenWords[i]);
        i++;
    }
    ForbidenWordsLoaded = i;
    fclose(handle);
    printf("Words loaded: %d", ForbidenWordsLoaded);
    return 1;
}
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new j = 0; j < ForbidenWordsLoaded; j++)
    {
        DisableBadword(ForbidenWords[j]);
    }
    return 1;
}
I don't see anything touch "text" there.
Reply
#3

How are we supposed to help without knowing the contents of the DisableBadword function?
Reply
#4

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
How are we supposed to help without knowing the contents of the DisableBadword function?
:b...
Quote:
Originally Posted by Rafelder_GRF
Посмотреть сообщение
DisableBadWord(word[])
word[] - word which will be disabled
pawn Код:
#define DisableBadword(%1) for(new i=0; i<strlen(text); i++) if(strfind(text[i], %1, true) == 0) for(new a=0; a<256; a++) if (a >= i && a < i+strlen(%1)) text[a]='*'
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Seriously, just use normal functions!
What? :/
Reply
#6

Quote:
Originally Posted by varthshenon
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    for(new j = 0; j < ForbidenWordsLoaded; j++)
    {
        DisableBadword(ForbidenWords[j]);
    }
    return 1;
}
I don't see anything touch "text" there.
+1. Where is it doing something with the text[] parameter of OnPlayerText? It doesn't get processed, Meaning it doesn't even modify the player's message... So, how can it censor stuff?
Reply
#7

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
+1. Where is it doing something with the text[] parameter of OnPlayerText? It doesn't get processed, Meaning it doesn't even modify the player's message... So, how can it censor stuff?
Uhh..
pawn Код:
#define DisableBadword(%1) for(new i=0; i<strlen(text); i++) if(strfind(text[i], %1, true) == 0) for(new a=0; a<256; a++) if (a >= i && a < i+strlen(%1)) text[a]='*'
EDIT:
For you to see that it works:

EDIT 2:
Here is my command
pawn Код:
CMD:forbidword(playerid,params[])
{
    if(PInfo[playerid][Level] < 3) return SendNeedLevel(playerid,3);
    new word[20],tempstr[23];
    if(sscanf(params,"s",word)) return SendClientMessage(playerid,green2,"USAGE: /forbidword "cyellow"<word>");
    new File:Forbidenwordsfile;
    Forbidenwordsfile = fopen("FAdmin/Logs/Forbidenwords.txt", io_append);
    format(tempstr,sizeof(tempstr),"%s\n",word);
    fwrite(Forbidenwordsfile, tempstr);
    fclose(Forbidenwordsfile);
    LoadForbidenWords();
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)