toggleControl
Client
Turns one of the local player's controls on or off. A control that is off does not reach the game, even with its key held down.
Also exists on the server, with its own implementation: toggleControl
bool toggleControl(string control, bool enabled)
Parameters
| Name | Type | Description |
|---|---|---|
| control | string | The control's name, case insensitive. |
| enabled | bool | true to turn it on, false to turn it off. |
Returns
true if it changed. false if the control name does not exist.
Turning off fire (or vehicle_fire inside a vehicle) stops the player from shooting. On a movement control, the direction that is off is zeroed.
Example
toggleControl("fire", false)
toggleControl("aim_weapon", false)
setTimer(function()
toggleControl("fire", true)
toggleControl("aim_weapon", true)
end, 10000, 1)Coming from MTABesides MTA's controls, MYMP has
block (melee block) and reload.