TTeam.OnBeforeJoin
property OnBeforeJoin Access mode: RW Event handler type: TOnBeforeJoinTeamEvent Event handler declaration: function (Player: TActivePlayer; Team,OldTeam: TTeam): ShortInt;
Description
Event property called when a player tries to change team
Example
function OnBeforeJoin(Player: TActivePlayer; Team, OldTeam: TTeam): ShortInt;
begin
if Team.ID = 2 then //Lock Bravo team
Result := -1
else
Result := Team.ID;
if OldTeam <> nil then
Player.WriteConsole(inttostr(Team.ID)+', Old: '+inttostr(OldTeam.ID), $FFFFFF);
end;
// ...
begin
// assign OnBeforeJoinTeam handler
Game.Teams[2].OnBeforeJoin := @OnBeforeJoin;
// ...
// unassign
Game.Teams[2].OnBeforeJoin := nil;
end;