GetPlayerBrain

From Data Realms Wiki

Revision as of 09:05, 27 May 2011 by Abdul Alhazred (Talk | contribs)
Jump to: navigation, search
Function
SyntaxGetPlayerBrain( (number) Team )
Description:
Returns current brain for specified player.
ReturnsActor




Example
DescriptionFinds any brains that belongs to the active human players. The pointer returned by GetPlayerBrain is not guaranteed to be safe to access so check it with MovableMan:IsActor before using it.
Code
  1. for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
  2.         if Activ:PlayerActive(player) then
  3.                 local Brain = Activ:GetPlayerBrain(player)
  4.                 if Brain and MovableMan:IsActor(Brain) then
  5.                         print("Player #" .. player .. " has a brain")
  6.                 end
  7.         end
  8. end
OutputPrints the player number of any active brain that belongs to a human player.
Personal tools