Script Name: Bad names
Script Description: A script that allows you to ban or kick certain names that's in a textfile.
Original Author: UpNorth.Se
Core Version: 2.5.2
procedure OnJoinTeam(IP, Nickname: string;Team: byte);
var bNames, bType, wtf: TStringArray;
begin
bNames:= split(ReadFile('bnames.txt'),chr(13)+chr(10));
for i:=0 to ArrayHigh(bNames)-1 do begin
bType := split(bNames[i],':');
if Copy(bType[0],Length(bType[0]), 1) = '*' then begin
if Copy(LowerCase(Nickname),1,Length(bType[0])-1) = Copy(LowerCase(bType[0]),1, Length(bType[0])-1) then begin
if Copy(bType[1],1,5) = 'kick;' then begin
KickPlayer(NametoID(Nickname));
end;
if Copy(bType[1],1,3) = 'ban' then begin
wtf := split(bType[2],';');
if wtf[0] = '' then begin
wtf[0] := '0';
end;
BanPlayer(NametoID(Nickname), StrtoInt(wtf[0]));
end;
end;
end;
if Copy(bType[0],Length(bType[0]), 1) <> '*' then begin
if LowerCase(Nickname) = Copy(LowerCase(bType[0]),1, Length(bType[0])) then begin
if Copy(bType[1],1,5) = 'kick;' then begin
KickPlayer(NametoID(Nickname));
end;
if Copy(bType[1],1,3) = 'ban' then begin
wtf := split(bType[2],';');
if wtf[0] = '' then begin
wtf[0] := '0';
end;
BanPlayer(NametoID(Nickname), StrtoInt(wtf[0]));
end;
end;
end;
end;
end;
The text file (in this case bnames.txt, which have to be located in the soldatserver main directory) should look like this:
badname1:kick; //This will kick everyone that is exactly named badname1.
badname2*:kick; //This will kick everyone with badname2 in the beginning of his/her nick
badname3:ban:bantime; //Bantime can be 0 (Permanent) to whatever you like, in minutes.
badname4*:ban:bantime; //This will ban everyone with badname4 in the beginning of his/her nick
Note:
Not working with Linux servers at the moment because of the Split() function bug.
As you see Wildcards (*) are allowed.
Do not forget the ';' in the end or the script wont work (it's there so you can make comments on each row).
I've tested the script and it seems to work okey.
Let me know if you find any errors.