Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: Bonecrusher on December 28, 2011, 06:46:58 am
-
I was wondering if it's possible to kick players with a lot of empty spaces in their nicks via scripting. There is a group of players with spaces in their nicks and its really annoying as their nick is being displayed in the middle of my screen. I'd like to get rid of those players without banning them, basically i want them to delete empty spaces from their nicks.
example:
Nick: [a ]
if there are more than x spaces kick
-
const
MinSpaces = 4;
procedure OnJoinTeam(const Id, Team: byte);
begin
if (ContainsString(GetPlayerStat(Id, 'Name'), Replicate(' ', MinSpaces))) then
KickPlayer(Id);
end;
Untested. Let us know if this at least compiles, and/or works as intended.
-
is there such func in crapcore as Replicate()?
The only thing you can do is to kick them.
procedure OnJoinTeam(Id, Team: byte);
var
i, n: byte;
name: string;
begin
name := IDToName(Id);
for i := 1 to Length(name) do begin
if name[i] = ' ' then n := n + 1 else n := n div 2;
if n = 5 then begin
KickPlayer(ID);
break;
end;
end;
end;
Untested
-
thx a lot guys i will test it later and post results
-
is there such func in crapcore as Replicate()?
There is. Along with StringOfChar() (one is an alias to another)
-
const
MinSpaces = 4;
procedure OnJoinTeam(const Id, Team: byte);
begin
if (ContainsString(GetPlayerStat(Id, 'Name'), Replicate(' ', MinSpaces))) then
KickPlayer(Id);
end;
Untested. Let us know if this at least compiles, and/or works as intended.
works like a charm, thx curt!