Difference between revisions of "TTeam.Add"

From Soldat Community Wiki
Jump to: navigation, search
(new page)
 
m (Example)
 
Line 9: Line 9:
 
Example shown will move all players in Red team to Blue team.
 
Example shown will move all players in Red team to Blue team.
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
var  
+
var
  i: byte;
+
   p: TPlayer; // not needed, added for clarity
   p: TPlayer;
 
 
begin
 
begin
   for i := 0 to Team[1].Count - 1 do  
+
   while Team[1].Count > 0 do
 
   begin
 
   begin
     p := Team[1].Player[i];
+
     p := Team[1].Player[0];
 
     Team[2].Add(p);
 
     Team[2].Add(p);
 
   end;
 
   end;
Line 21: Line 20:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
[[Category:TActivePlayer]]
+
[[Category:TTeam]]

Latest revision as of 13:33, 24 July 2013

procedure Add(Player: TPlayer)
 Player: a Player that is supposed to be added to the Team

Description

Adds a player to Team's players list.
Changes player's team in game

Example

Example shown will move all players in Red team to Blue team.

var
  p: TPlayer; // not needed, added for clarity
begin
  while Team[1].Count > 0 do
  begin
    p := Team[1].Player[0];
    Team[2].Add(p);
  end;
end;