Author Topic: Command / visable in logs  (Read 3566 times)

0 Members and 1 Guest are viewing this topic.

Offline FireStone

  • Major(1)
  • Posts: 3
Command / visable in logs
« 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?

Offline FireStone

  • Major(1)
  • Posts: 3
Re: Command / visable in logs
« Reply #1 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?  :'(
« Last Edit: January 27, 2017, 03:32:10 pm by FireStone »

Offline Moroes

  • Soldier
  • **
  • Posts: 165
    • Soldat-Game.eu
Re: Command / visable in logs
« Reply #2 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.


#MakeSoldatGreatAgain

Btw: I am neither pascalist nor scripter but this.script shall do the job tho.


« Last Edit: January 28, 2017, 06:58:27 am by Moroes »

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Command / visable in logs
« Reply #3 on: January 28, 2017, 06:54:40 am »
Try it:

Offline Savage

  • Soldier
  • **
  • Posts: 155
Re: Command / visable in logs
« Reply #4 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

Offline FireStone

  • Major(1)
  • Posts: 3
Re: Command / visable in logs
« Reply #5 on: January 28, 2017, 11:28:29 am »
Thanks for all  :D