TTeam.OnBeforeJoin
Revision as of 22:52, 6 May 2020 by H (talk | contribs) (Created page with " '''''property OnBeforeJoin''''' Access mode: RW Event handler type: TOnBeforeJoinTeamEvent Event handler declaration: function (Player: TActivePlayer; Team,OldT...")
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;