GetPlayerType

Category: Player
Since engine version: 4.9.6.0 CR

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 iPlayer);

Parameter

iPlayer:
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 iPlr)
  {
  // Ist es ein Scriptspieler?
  if (GetPlayerType(iPlr) == C4PT_Script)
    {
    // Dann ein KI-Objekt erstellen
    CreateObject(_EAI, 50,50, iPlr);
    }
  return true;
  }
Scenario script: when a script player joins, an object of definition _EAI is created (owned by the joining script player). This object might now control all clonks owned by this player.
See also: CreateScriptPlayer, Script Player
Sven2, Dezember 2007