Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: ManSoft|Warlord on June 05, 2007, 01:49:40 am

Title: Anti-Flame
Post by: ManSoft|Warlord on June 05, 2007, 01:49:40 am
I donnot want to hear that this script is useless - use it or not.
Script Name: Antiflame-Script
Hint: If you want to enable auto-updates to your badwords.txt, you should start your Server with safemode off.
Script Description: With script it's possible to
1.) warn flamers
If they donnot stop flaming, they will be
2.) kicked
If they rejoin the server and flame again, the will be
3.) banned

This is script is going to be multi-lingual, but currently there is only an badwords.txt for my czech friends. So feel free to create your own badwords.txt and send it to me.

Original Author: Warlord, Snippets from KeYDoN
Core Version: (Tested with) 2.6.1
Code:
Code: [Select]
const
  ANTIFLAMELANG ='czech';
var
  badwords, badboys, vbadboys: TStringArray;
  warnstring: string;
  kickstring: string;
  banstring: string;
  words: string;
  badboysstring : string;

KeYDoN's xsplit:
Code: [Select]
function xsplit(const source: string; const delimiter: string):TStringArray;
var
  i,x,d:integer;
  s:string;
begin
d:=length(delimiter);
x:=0;
i:=1;
SetArrayLength(Result,1);
while(i<=length(source)) do begin
s:=Copy(source,i,d);   
    if(s=delimiter) then begin
    inc(i,d);
    inc(x,1);
    SetArrayLength(result,x+1);
    end else begin       
    result[x]:= result[x]+Copy(s,1,1);
    inc(i,1);
  end;
end;
end;

Code: [Select]
procedure refreshbadwords();
begin
writefile('badwords.txt',GetURL('http://web0.res0.45188.vs.webtropia.com/soldatnet/badwords/'+ANTIFLAMELANG+'.badwords.txt'));
try
try
badwords := XSplit(ReadFile('badwords.txt'),chr(13) + chr(10));
except
end;
try
if FileExists('warned.txt') = false then
begin
WriteFile('warned.txt', 'aäsdkaslakfkasf');
WriteLn('warned.txt does not exists - creating it.');
end;
badboysstring := ReadFile('warned.txt');
badboys := XSplit(badboysstring,chr(13) + chr(10));
except

end;
try
if FileExists('kicked.txt') = false then
begin
WriteFile('kicked.txt', 'aäsdkaslakfkasf');
WriteLn('kicked.txt does not exists - creating it.');
end;
badboysstring := ReadFile('kicked.txt');
vbadboys := XSplit(badboysstring,chr(13) + chr(10));
except

end;
finally
writeLn('|----------------------------------|');
writeLn('| Badwords loaded successfully...  |');
writeLn('|  (v)Badboys loaded successfully! |');
writeLn('| Done by Mankind-Software.com     |');
writeLn('|    Get it @ soldatnet.com!       |');
writeLn('|----------------------------------|');
end;
end;

Code: [Select]
procedure ActivateServer();
begin
  refreshbadwords;
end;

Code: [Select]
procedure OnPlayerSpeak(ID: byte; Text: string);
var
  i, j, k: integer;
  temp, tmpip: string;
begin
for i:=0 to arrayhigh(badwords)-1 do
begin
if ContainsString(LowerCase(Text), badwords[i]) = true then
begin
for k:=0 to arrayhigh(vbadboys)-1 do
if LowerCase(vbadboys[k]) = LowerCase(IdToName(ID)) then
begin
DrawText(0,badwords[1],330,RGB(255,10,10),0.1,5,240);
command('/say '+IdToName(ID)+' '+badwords[3]);
tmpip := IdToIP(ID);
BanPlayer(ID, 0);
command('/banip '+tmpip);
break;
end;

for j:=0 to arrayhigh(badboys)-1 do
if LowerCase(badboys[j]) = LowerCase(IdToName(ID)) then
begin
DrawText(0,badwords[1],330,RGB(255,10,10),0.1,5,240);
command('/say '+IdToName(ID)+' '+badwords[1]);
WriteFile('kicked.txt', ReadFile('kicked.txt')+chr(13)+chr(10)+IdToName(ID));
KickPlayer(ID);
refreshbadwords;
break;
end;

for j:=0 to arrayhigh(badboys)-1 do
if LowerCase(badboys[j]) <> LowerCase(IdToName(ID)) then
begin
DrawText(0,badwords[0],330,RGB(255,10,10),0.1,5,240);
command( '/say '+IdToName(ID)+' '+badwords[0]);
WriteFile('warned.txt', ReadFile('warned.txt')+chr(13)+chr(10)+IdToName(ID));
refreshbadwords;
break;
end;
    end;
end;
end;

Code: [Select]
procedure AppOnIdle(Ticks: integer);
begin
if Ticks mod (3600 * 5) = 0 then
refreshbadwords; 
end;

If you want to tell your players, that this server is protected, use this:
Code: [Select]
procedure OnJoinTeam(ID, Team: byte);
begin
WriteConsole(ID,'Server is secured by Antiflame-Script.',RGB(255,185,15));
WriteConsole(ID,'Check Soldatnet.com for more Details.',RGB(255,185,15));
end;

Quote from: czech.badwords.txt
nebud jak maly, nadavky jsou trestne !
vykopnut za nadavky, po treti to bude ban !
byl zabanovan za nadavky !
pic
hajzl
kokot
kund
krypl
zmrd
srack
curak
curac
kurv
kreten
uchyl
zkurvysyn
dement
sulin
devk
buzn
buzerant
****
****
idiot
****
ass
suck
pako
paka
magor
jeb
mrd
demence

Here are the first 3 lines of the english.badwords.txt:
Don't be like a child, badwords are forbidden.
You will be kicked for badwords.
You will be banned for badwords.
Title: Re: Anti-Flame
Post by: Leo on June 05, 2007, 05:17:30 am
Nice try but a waste of time. You can't beat people's imagination in finding bad words. Besides this is an online game, a little cursing is a must :P
Title: Re: Anti-Flame
Post by: SoNNy on June 05, 2007, 06:50:23 am
nice work mansoft again, this stuff is what i need, keep up good work man !  ;)


*APPLAUD*
Title: Re: Anti-Flame
Post by: miketh2005 on August 23, 2007, 05:55:09 pm
aww man like this REALLY needs to be zipped i dont know what to do, sry for all the bumping :(
Title: Re: Anti-Flame
Post by: Dr. Zombi3 on August 23, 2007, 08:23:13 pm
I agree with leo