getControlState
Client
Tells whether one of a ped's controls is pressed, such as forwards, fire or accelerate.
Also exists on the server, with its own implementation: getControlState
bool getControlState(string control [, ped thePed = localPlayer])
Parameters
| Name | Type | Description |
|---|---|---|
| thePed | ped | The ped or player. It can be left out, which means the local player.default localPlayer |
| control | string | The control's name, case insensitive. |
Returns
true if the control is pressed. false if it is not, if the control name does not exist or if the ped cannot be read.
On the local player it reads what the game gets this frame, including what a script turned on with setControlState. Vehicle controls only count inside a vehicle and on-foot ones only outside; with the engine off, accelerate does not count. On a remote player it reads the controls that came over the network. On a ped it reads what a script set on it.
Example
addEventHandler("onClientRender", root, function()
if getControlState("sprint") then
dxDrawText("Correndo", 20, 300)
end
end)Coming from MTABesides MTA's controls, MYMP has
block (melee block) and reload.