TTeam.OnJoin

From Soldat Community Wiki
Revision as of 16:25, 9 September 2013 by Mighty (talk | contribs) (Export fix (1.6.6b))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
property OnJoin
 Access mode: RW
 Event handler type: TOnJoinTeamEvent
 Event handler declaration: procedure (Player: TActivePlayer; Team: TTeam);

Description

Event property called when a player tries to change team

Example

 procedure MyOnJoinTeamHandler(temp: TPlayer; Team: TTeam);
 var 
   Player: TActivePlayer;
 begin
   Player := TActivePlayer(temp); // this is important! Without that you can't use many TActivePlayer members!
   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;