M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
thePlayerplayerThe player.
enabledbooltrue to turn them on, false to turn them off.
gtaControlsboolWhether it applies to the game's controls, such as walking, shooting and driving. The server keeps this state for isControlEnabled.default true
mtaControlsboolWhether 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)

See also