M MY Multiplayer: Wiki
Side
Kind

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

NameTypeDescription
thePlayerplayerThe player.
controlstringThe control's name, case insensitive.
enabledbooltrue 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.

See also