- Documentation
- Server functions
- getPedControlState
Function
getPedControlState
Checks whether a ped's control is pressed according to the state set by scripts (setPedControlState or setPedAnalogControlState). It does not read the keys a player physically presses; use getControlState on the client for that.
Syntax
bool getPedControlState(ped ped, string control)Arguments
pedped- A player or an NPC.
controlstring- Control name, e.g.
"forwards".
Returns
true when pressed.
Example
if getPedControlState(walker, "sprint") then outputServerLog("biegnie") end
See also
setPedControlStatePresses or releases a virtual control of a ped, e.g.forwards(walk forward) orsprint. For NPCs every player's game carries outforwards,backwardsandsprint, so the ped walks or runs the way it faces; other control names are stored for scripts and returned bygetPedControlState. Names are the same as inbindKey/toggleControl(e.g.fire,jump,crouch,walk).getPedControlStatesReturns at once a list of every ped control that scripts set as pressed. Handy for debugging NPCs or for saving and later restoring their state.