Official Soldat Forums
Server Talk => Scripting Discussions and Help => Topic started by: FireStone on January 27, 2017, 10:21:19 am
-
Hello guys. How to see that what someone was typing on " / " (example: /adminlog /kill /smoke /victory) command on the server
Is there any script that would make me able to check such things?
-
I have used this procedure in my script:
function OnCommandNoSelfkill(Player: TActivePlayer; Command: string): Boolean;
begin
case lowercase(Command) of
'/kill','/brutalkill','/mercy': Result := TRUE;
else Result := FALSE;
end;
end;
var
i: Byte;
begin
for i:=1 to 32 do
Players[i].OnCommand := @OnCommandNoSelfkill;
end.
but commads like /kill, /brutalkill etc. still doesn't appear in server logs. Any ideas? :'(
-
I have used this procedure in my script:
blabla hue hue
That example just shows how to block certain commands by setting the result as true. That means the listed commands /kill, /brutalkill and /mercy won't do any harm ingame and they will be simply ignored.
Most of the admin cmds and nonstandart(aka bullshit) cmds can be actually seen in the logs. Classic player cmds and short ones are left out tho, probably to reduce the spam in the console.
So you gotta decide what you really want to see in your logs.
Here's an example:
function OnCommandOutput(Player: TActivePlayer; Command: string): Boolean;
begin
if ExecRegExpr('^/adminlog [A-Za-z0-9_]*', Command) then WriteLn(+Command+'('+Player.IP+'|'+Player.HWID+'['+Player.NAME+'])');
case lowercase(Command) of
'/kill','/brutalkill','/mercy','/smoke','/victory':
WriteLn(+Command+'('+Player.IP+'['+Player.NAME+'])');
end;
Result := FALSE;
end;
var
i: Byte;
begin
for i:=1 to 32 do
Players[i].OnCommand := @OnCommandOutput;
end.
(http://i66.tinypic.com/2ywwj2p.png)
#MakeSoldatGreatAgain
Btw: I am neither pascalist nor scripter but this.script shall do the job tho.
-
Try it:
-
function OnPlayerCommand(Player: TActivePlayer; Command: String): Boolean;
begin
WriteLn('OnPlayerCommand: ['+Player.Name+'] '+Command);
Result := False;
end;
procedure Initialize;
var
i: Byte;
begin
for i := 1 to 32 do begin
Players[i].OnCommand := @OnPlayerCommand;
end;
end;
begin
Initialize;
end.
You will see the output in the console and consolelog.txt
-
Thanks for all :D