Author Topic: swearFilter  (Read 4980 times)

0 Members and 1 Guest are viewing this topic.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
swearFilter
« on: November 07, 2006, 01:00:05 pm »
Script Name: swearFilter
Script Description: script which can kick and ban player who is swearing on server
Original Author: cooz
Core Version: 2.5.2

Code: [Select]
KICK_LIMIT = 3;
BAN_LIMIT = 4;
BAN_TIME = 60;
COUNT_METHOD = 0;
LOWER_COUNT = 5;

LISTCOUNT = 6;

var
swearList: array[1..32] of string;
swearCount: array[1..LISTCOUNT] of integer;
i: integer;

procedure ActivateServer();
begin

swearList[1]:='****';
swearList[2]:='*****';
swearList[3]:='*****';
swearList[4]:='****';
swearList[5]:='*******';
swearList[6]:='justin timberlake';

end;

procedure OnPlayerSpeak(Name,Text: string);
begin
  for i:=1 to LISTCOUNT do if ContainsString(LowerCase(Text),swearList[i]) then begin
    swearCount[NametoID(Name)]:=swearCount[NametoID(Name)]+1;
    SayToPlayer(NametoID(Name),'stop swearing or you''ll be banned');
    if((swearCount[NametoID(Name)]>=KICK_LIMIT)and(swearCount[NametoID(Name)]<BAN_LIMIT)) then begin
      //SayToPlayer(NametoID(Name),'i said ya, kick biatch');
      KickPlayer(NametoID(Name));
      break;
    end;
    if swearCount[NametoID(Name)] >= BAN_LIMIT then begin
      //SayToPlayer(NametoID(Name),'that''s ****ing enough, BAN');
      BanPlayer(NametoID(Name),BAN_TIME);
      swearCount[NametoID(Name)]:=0;
      break;
    end;
    if COUNT_METHOD = 0 then break;
  end;
end;

procedure AppOnIdle(Ticks: integer);
begin
  if Ticks mod (3600*LOWER_COUNT) = 0 then begin
    for i:=1 to 32 do swearCount[i]:=swearCount[i]-1;
  end;
end;

procedure OnCommand(ID: integer;Text: string);
begin
  if Text = '/resetfilter' then begin
    for i:=1 to 32 do swearCount[i]:=0;
  end;
end;

first of all: HAHAha forum censored my swearlist ;D

note:
  please remeber to add swears to swearList in lower case, thank you

features:
- admin commands:
  /resetfilter - it resets cout of swears of each person
- script switches:
  KICK_LIMIT - after how many swears it will kick player ( default: 3 )
  BAN_LIMIT - after how many swears it will ban player ( default: 4 )
  BAN_TIME - ban time in minutes ( default: 60 )
  COUNT_METHOD - choose: 0 - counts sentences, 1 - counts swears in sentense  ( default: 0 )
  LOWER_COUNT - how often it will lower count of swears of each person ( default: 5 )
  LISTCOUNT - very important after extending swearList remeber to change this value, it's count of swears in list (in example list: 6)

how does it work:
  with default values it will kick player after 3 sentences containing some swears, next swear of that person will equal to ban for 1h, also it will lower count of swears every 5 minutes

made on request ::)

i hope you like it, enjoy
« Last Edit: November 29, 2006, 04:05:44 pm by cooz »
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: swearFilter
« Reply #1 on: November 07, 2006, 04:50:03 pm »
very nice, i'll modify it for my purposes and test it
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline zgrabarz

  • Major(1)
  • Posts: 22
Re: swearFilter
« Reply #2 on: November 09, 2006, 02:02:05 pm »
how i can mix two scripts?

like procedure OnPlayerSpeak(Name,Text: string);
 "  if Text = '!joinA' then  Command('/setteam1 '+IntToStr(NameToID(Name))); "
with swearFilter ?
« Last Edit: November 09, 2006, 02:03:41 pm by zgrabarz »

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: swearFilter
« Reply #3 on: November 09, 2006, 08:20:57 pm »
Edit ScriptA and put your changes from ScriptB into ScriptA... and read this sticky.

Offline Crimson Goth

  • Camper
  • ***
  • Posts: 387
  • A*|INF|Veteran
Re: swearFilter
« Reply #4 on: November 10, 2006, 01:41:11 pm »
justin timberlake is swearing??

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
Re: swearFilter
« Reply #5 on: November 10, 2006, 07:35:31 pm »
justin timberlake is swearing??

Please try to keep posting to on topic discussion.

Offline KentheGreat

  • Soldier
  • **
  • Posts: 102
    • a Kennie blog
Re: swearFilter
« Reply #6 on: November 11, 2006, 05:51:37 am »
justin timberlake is swearing??

Please try to keep posting to on topic discussion.

In the swearlist (which cooz says was censured by the forum) it says justin timberlake, which is ment to be a swear but due to the forum's swearfilter it was censored.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
Re: swearFilter
« Reply #7 on: November 11, 2006, 06:28:54 am »
justin timberlake is swearing??

that's just a joke, sorry if i offended you with that
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like

Offline MR X

  • Soldier
  • **
  • Posts: 148
  • Soldat Rulezz and must be played forever
Re: swearFilter
« Reply #8 on: March 17, 2007, 01:05:01 pm »
Ready for a stupid question  :P. Where do i put this scripts?
Soldat Rulezz and must be played forever

Offline nub

  • Major
  • *
  • Posts: 56
Re: swearFilter
« Reply #9 on: March 17, 2007, 07:10:36 pm »
Into your server's scripts directory (NetworkCore.pas). Also read: http://forums.soldat.pl/index.php?topic=7516.0

But you should only install this script, if you have the time to nurture it... there are too many bugs inside.
Можно зарезать, украсть и всё-таки быть счастливым...

Offline FliesLikeABrick

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 6144
    • Ultimate 13 Soldat
Re: swearFilter
« Reply #10 on: March 17, 2007, 09:43:17 pm »
also read this if you don't know how to install scripts: http://forums.soldat.pl/index.php?topic=11622.0

Offline MR X

  • Soldier
  • **
  • Posts: 148
  • Soldat Rulezz and must be played forever
Re: swearFilter
« Reply #11 on: March 18, 2007, 06:53:52 am »
Aaahh now i get it. I see it's a relative new feature. i never heard of this type of scripting :D. Ty guys for helping me out.

Regards Mr X
Soldat Rulezz and must be played forever