toggleAllControls
Server
Turns all of a player's controls on or off at once. The order goes to their client.
Also exists on the client, with its own implementation: toggleAllControls
bool toggleAllControls(player thePlayer, bool enabled [, bool gtaControls = true, bool mtaControls = true])
Parameters
| Name | Type | Description |
|---|---|---|
| thePlayer | player | The player. |
| enabled | bool | true to turn them on, false to turn them off. |
| gtaControls | bool | Whether it applies to the game's controls, such as walking, shooting and driving. The server keeps this state for isControlEnabled.default true |
| mtaControls | bool | Whether it applies to the keys the client bound to commands with bindKey. While off, those keys do not run their command.default true |
Returns
true if the order was sent. false if the element is not a player.
Example
addEventHandler("onPlayerSpawn", root, function()
toggleAllControls(source, false)
setTimer(toggleAllControls, 3000, 1, source, true)
end)