GetPlayerControlState

Category: Player
Since engine version: 5.1 OC

Description

Returns the current state of a control for a certain player. The return value is the strength of the control (e.g. for gamepad joysticks). If the control is assigned to a key, a value not equal to 0 means that the key is currently held down by the player.

Syntax

int GetPlayerControlState(int player, int control);

Parameters

player:
Number of the player whose control state you want to query.
control:
Control to query. A CON_* constant should be used here.

Example

if (GetPlayerControlState(GetOwner(), CON_Left) != 0)
    Log("You are currently holding down the left cursor key!");
Prints a message when the player is holding down the key assigned to the control CON_Left.
See also: GetPlayerControlAssignment
Zapper, 2015-10