M MY Multiplayer: Wiki
Side
Kind

isControlEnabled

Server

Tells whether one of a player's controls is on, going by what the server sent to their client.

Also exists on the client, with its own implementation: isControlEnabled

bool isControlEnabled(player thePlayer, string control)

Parameters

NameTypeDescription
thePlayerplayerThe player.
controlstringThe control's name, case insensitive.

Returns

true if the control is on. false if the server turned it off, the element is not a player or the control name does not exist.

Example

addCommandHandler("canshoot", function(player)
    if not isControlEnabled(player, "fire") then
        outputServerLog(getPlayerName(player) .. " is not allowed to shoot")
    end
end)
NoteIt only reflects what the server sent with toggleControl and toggleAllControls. A control turned off by a client script is still true here.

See also