TActivePlayer.OnCommand

From Soldat Community Wiki
Jump to: navigation, search
property OnCommand
 Access mode: RW
 Event handler type: TOnCommandEvent
 Event handler declaration: function (Player: TActivePlayer; Command: string): Boolean

Description

Event property called whenever a player uses a command.
If the result is set to TRUE, the default command effect (like /kill) will be ignored

Example

Example disables /kill, /brutalkill and /mercy commands

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.