Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: cooz on November 07, 2006, 01:00:05 pm

Title: swearFilter
Post by: cooz 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
Title: Re: swearFilter
Post by: Avarax on November 07, 2006, 04:50:03 pm
very nice, i'll modify it for my purposes and test it
Title: Re: swearFilter
Post by: zgrabarz 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 ?
Title: Re: swearFilter
Post by: EnEsCe on November 09, 2006, 08:20:57 pm
Edit ScriptA and put your changes from ScriptB into ScriptA... and read this sticky (http://forums.soldat.pl/index.php?topic=7516.0).
Title: Re: swearFilter
Post by: Crimson Goth on November 10, 2006, 01:41:11 pm
justin timberlake is swearing??
Title: Re: swearFilter
Post by: chrisgbk on November 10, 2006, 07:35:31 pm
justin timberlake is swearing??

Please try to keep posting to on topic discussion.
Title: Re: swearFilter
Post by: KentheGreat 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.
Title: Re: swearFilter
Post by: cooz on November 11, 2006, 06:28:54 am
justin timberlake is swearing??

that's just a joke, sorry if i offended you with that
Title: Re: swearFilter
Post by: MR X on March 17, 2007, 01:05:01 pm
Ready for a stupid question  :P. Where do i put this scripts?
Title: Re: swearFilter
Post by: nub 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.
Title: Re: swearFilter
Post by: FliesLikeABrick 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
Title: Re: swearFilter
Post by: MR X 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