GetPlayerBrain
From Data Realms Wiki
(Difference between revisions)
m (Removed stub tag.) |
|||
Line 4: | Line 4: | ||
|returns = [[Actor]] | |returns = [[Actor]] | ||
|description = Returns current brain for specified player. | |description = Returns current brain for specified player. | ||
+ | |codedesc = Finds 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 = <code lua n>for player = Activity.PLAYER_1, Activity.MAXPLAYERCOUNT - 1 do | ||
+ | if Activ:PlayerActive(player) then | ||
+ | local Brain = Activ:GetPlayerBrain(player) | ||
+ | if Brain and MovableMan:IsActor(Brain) then | ||
+ | print("Player #" .. player .. " has a brain") | ||
+ | end | ||
+ | end | ||
+ | end</code> | ||
+ | |output = Prints the player number of any active brain that belongs to a human player. | ||
|}} | |}} |
Revision as of 09:05, 27 May 2011
Function | |
---|---|
Syntax | GetPlayerBrain( (number) Team ) |
Description: | |
Returns current brain for specified player. | |
Returns | Actor |
Example | |
---|---|
Description | Finds 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 |
|
Output | Prints the player number of any active brain that belongs to a human player. |