TActivePlayer.OnFlagGrab

From Soldat Community Wiki
Jump to: navigation, search
property OnFlagGrab
 Access mode: RW
 Event handler type: TOnFlagGrabEvent
 Event handler declaration: procedure (Player: TActivePlayer; TFlag: TActiveFlag; Team: Byte; GrabbedInBase: Boolean);

Description

Event property called when a player captures an enemy flag (or a pointmatch flag).

Example

Example shows a message if a player captured the flag in base.

procedure OnFlagGrabMsg(Player: TActivePlayer; TFlag: TActiveFlag; Team: Byte; GrabbedInBase: Boolean);
begin
  if GrabbedInBase then
    Players.Tell(Player.Name + ' has captured the flag at enemy base!');
end;

var 
  i: Byte;
begin
  for i:=1 to 32 do
    Players[i].OnFlagGrab := @OnFlagGrabMsg;
end.