Category: Player
Since engine version: 1.0 OC
GetPlayerType
Description
Returns the type of a player. Possible values are:
Constant | Value | Description |
---|---|---|
C4PT_User | 1 | User-controlled player. |
C4PT_Script | 2 | Script-controlled player; i.e. AI player. |
Syntax
int GetPlayerType(int player);
Parameter
- player:
- Number of the player whose type you want to retrieve.
Remark
If the specified player number is invalid, the return value is 0.
Example
protected func InitializePlayer(int player) { // Is it a script player? if (GetPlayerType(player) == C4PT_Script) // then create an AI controller object for that player CreateObject(SomeAIController, 50,50, player); return true; }
Scenario script: when a script player joins, an object of definition SomeAIController is created (owned by the joining script player). This object might now control all clonks owned by this player.
See also: CreateScriptPlayer, Script Player