Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: FireStone on January 27, 2017, 10:21:19 am

Title: Command / visable in logs
Post 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?
Title: Re: Command / visable in logs
Post by: FireStone on January 27, 2017, 03:30:26 pm
I have used this procedure in my script:

Code: [Select]
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?  :'(
Title: Re: Command / visable in logs
Post by: Moroes on January 28, 2017, 06:08:19 am
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:

Code: [Select]
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.


Title: Re: Command / visable in logs
Post by: soldat-game on January 28, 2017, 06:54:40 am
Try it:
Title: Re: Command / visable in logs
Post by: Savage on January 28, 2017, 09:29:39 am
Code: [Select]
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
Title: Re: Command / visable in logs
Post by: FireStone on January 28, 2017, 11:28:29 am
Thanks for all  :D