toggleControl
Server
Turns one of a player's controls on or off. Their client stops passing that control to the game, even with its key held down.
Also exists on the client, with its own implementation: toggleControl
bool toggleControl(player thePlayer, string control, bool enabled)
Parameters
| Name | Type | Description |
|---|---|---|
| thePlayer | player | The player. |
| control | string | The control's name, case insensitive. |
| enabled | bool | true to turn it on, false to turn it off. |
Returns
true if the order was sent to the client. false if the element is not a player or the control name does not exist.
The server keeps the state it sent, which isControlEnabled returns later.
Example
addEventHandler("onPlayerVehicleEnter", root, function(vehicle)
toggleControl(source, "vehicle_fire", false)
toggleControl(source, "vehicle_secondary_fire", false)
end)Coming from MTABesides MTA's controls, MYMP has
block (melee block) and reload.