Difference between revisions of "TTeam.OnJoin"

From Soldat Community Wiki
Jump to: navigation, search
m (Example)
m (Description)
Line 5: Line 5:
  
 
==Description==
 
==Description==
Event property called when any player leaves the server or gets kicked/banned.
+
Event property called when a player tries to change team
 
<br>
 
<br>
  

Revision as of 13:31, 26 July 2013

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
   if Team.ID = 2 then
   begin
     Player.Team := 1;
     Player.Tell('Sorry, you can''t join Bravo Team');
   end;
 end;

 // ...

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

   // ...

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