Author Topic: Script that kills players using badwords stored in a badwordlist via adminkill  (Read 666 times)

0 Members and 1 Guest are viewing this topic.

Offline Zischer

  • Major(1)
  • Posts: 32
Hiho,

I am looking for a script that kills players via adminkill if they use badwords which are stored in a badwordlist for the /th/ KnifeOnly Servers (http://wiki.soldat.nl/Th).

There is no need to kick or ban players, it would just be nice if they will be punished via automatic "killed by admin" if they use bad words (I myself want to be able to determine which words these are).

I already have a badwordfilter script on the servers (this one http://soldat.jrgp.org/?action=script&id=2 ), but I am not that pleased with it for it bans/kicks players (although you can turn it off) and for it is just able to kill players via selfkill (does not work everytime, just when the respective player is alive ingame, meaning not already dead and waiting for respawn (which is exactly the period most of the players use insulting language)).

I myself am unfortunately not able to write scripts, but if anybody can and like to, thank you in advance!!!

I personally dont think that a nice little script like this means too much work, does it? :>

Kind regards.
« Last Edit: April 29, 2009, 09:32:05 am by Zischer »

Offline GSx_Major

  • Major
  • *
  • Posts: 97
You could have read more than the first two lines...


Lazy solution: edit everything after line 62 to

Code: [Select]
  if Bad then
    Command('/kill ' + IntToStr(PlayerID));

end;

 ::)
...and headbutt the sucker through your banana suit!

Offline Zischer

  • Major(1)
  • Posts: 32
Yeah, after trying a hundred times and failing - now it seems to work :D.. thank you!!!

BUT - I cant turn off the kick :>.. so after a defined number of warnings players will be kicked - I dont like that.

A possibility to change this? (I already tried.. well, server went down^^.. I am no good in programming).
« Last Edit: April 30, 2009, 03:31:48 am by Zischer »

Offline GSx_Major

  • Major
  • *
  • Posts: 97
jrgps script, minus the stuff you don't need if you just want to kill.

Code: [Select]
// Config
const
  FileName = 'BadWordsList.txt'; //file which holds the badwords, each seperated with a space

// Holders of information
var
BadWords: TStringArray;
HaveBadWords: Boolean;

// Credits to DorkeyDear - http://forums.soldat.pl/index.php?topic=27844.0
function Explode(Source: String; const Delimiter: String): Array of String;
var TempStr: String;
begin
Source := Source + Delimiter;
repeat
TempStr := GetPiece(Source, Delimiter, 0);
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[GetArrayLength(Result) - 1] := TempStr;
Delete(Source, 1, Length(TempStr) + Length(Delimiter));
until Length(Source) = 0;
end;

//load badwords list
procedure ActivateServer();
begin
if not FileExists(FileName) then
begin
WriteLn('Cannot find badwords file')
HaveBadWords := false;
exit;
end;

BadWords := Explode(UpperCase(ReadFile(FileName)), ' ');
HaveBadWords := True;
end;

//whenever someone says something, check it.
procedure OnPlayerSpeak(PlayerID: Byte; Text: string);
var i: integer;
var Bad: boolean;
begin
//do we any badwords to check?
if not HaveBadWords then
exit;

//for now, make it false
Bad := false;

//check it!
for i := 0 to GetArrayLength(BadWords) - 1 do
if ContainsString(UpperCase(Text), BadWords[i]) then
Bad := true;

//saying something naughty?
if Bad then
Command('/kill ' + IntToStr(PlayerID));

end;
...and headbutt the sucker through your banana suit!

Offline Zischer

  • Major(1)
  • Posts: 32
Yeah, thanks a million man!!! It works perfectly, just the way I wanted it to be!
« Last Edit: May 01, 2009, 07:38:49 am by Zischer »