GetPlayerBrain

From Data Realms Wiki

Revision as of 15:41, 1 June 2011 by Abdul Alhazred (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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. local Activ = ActivityMan:GetActivity()
  2. for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do
  3.         if Activ:PlayerActive(player) then
  4.                 local Brain = Activ:GetPlayerBrain(player)
  5.                 if Brain and MovableMan:IsActor(Brain) then
  6.                         print("Player #" .. player .. " has a brain")
  7.                 end
  8.         end
  9. end
OutputPrints the player number of any active brain that belongs to a human player.
Personal tools