- Documentation
- Server functions
- getPedControlStates
Function
getPedControlStates
Returns 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.
Syntax
table getPedControlStates(ped ped)Arguments
pedped- A player or an NPC.
Returns
A sorted list of pressed control names.
Example
outputServerLog(table.concat(getPedControlStates(walker), ", "))
See also
getPedControlStateChecks whether a ped's control is pressed according to the state set by scripts (setPedControlStateorsetPedAnalogControlState). It does not read the keys a player physically presses; usegetControlStateon the client for that.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).