Category: Player
Since engine version: 1.0 OC (extended in 8.0 OC)
GetPlayerControlState
Description
Returns the current state of a control for a certain player. 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. For analog controls on gamepads, the function either queries the current emulated button state (analog_strength = false), or the current position of the stick or trigger (analog_strength = true).
Syntax
int GetPlayerControlState(int player, int control, bool analog_strength);
Parameters
- player:
- Number of the player whose control state you want to query.
- control:
- Control to query. A CON_* constant should be used here.
- analog_strength:
- [opt] If true: Query current state of an analog control on a gamepad instead of the emulated button state.
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