TTeam.OnJoin

From Soldat Community Wiki
Revision as of 13:52, 29 July 2013 by Falcon (talk | contribs) (Example)
Jump to: navigation, search
property OnJoin
 Access mode: RW
 Event handler type: TOnJoinTeamEvent
 Event handler declaration: procedure (Player: TPlayer; Team: TTeam);

Description

Event property called when a player tries to change team

Example

 procedure MyOnJoinTeamHandler(Player: TActivePlayer; Team: TTeam);
 begin
   Player.Team := 1;
   Player.Tell('Sorry, you can''t join Bravo Team');
 end;

 // ...

 begin
   // assign OnJoinTeam handler
   Game.Teams[2].OnJoin := @MyOnJoinTeamHandler;

   // ...

   // unassign
   Game.Teams[2].OnJoin := nil;
 end;