Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define MAX_LEN 32
- #define MAX_ENTRY 120
- static Swear[MAX_ENTRY][MAX_LEN];
- public OnFilterScriptInit()
- {
- if(fexist("swear.txt")) {
- new File:myFile,
- line[MAX_LEN],
- index=0;
- myFile=fopen("swear.txt",filemode:io_read);
- while(fread(myFile,line,sizeof line) && (index != MAX_ENTRY)) {
- if(strlen(line)>MAX_LEN) continue;
- StripNewLine(line);
- strmid(Swear[index],line,0,strlen(line),sizeof line);
- index++;
- }
- }
- return 1;
- }
- public OnPlayerText(playerid,text[])
- {
- for(new i=0; i<MAX_ENTRY; i++) {
- if(!Swear[i][0]) continue;
- Cenzura(text,Swear[i]);
- }
- return 1;
- }
- stock StripNewLine(str[]) // ysi-misc.own
- {
- new l = strlen(str);
- while (l-- && str[l] <= ' ') str[l] = '\0';
- }
- stock Cenzura(string[],word[],destch='*')
- {
- new start_index=(-1),
- end_index=(-1);
- start_index=strfind(string,word,true);
- if(start_index==(-1)) return false;
- end_index=(start_index+strlen(word));
- for( ; start_index<end_index; start_index++)
- string[start_index]=destch;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment