ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. toggleAllControls

Function

toggleAllControls

Server and clientInput and controlsIdentical to MTA:SA

Enables or disables all game controls at once (e.g. during a cutscene or when freezing a player). Chat, console and bindKey keys keep working.

Syntax

Server

bool toggleAllControls(player thePlayer, bool enabled [, bool gtaControls = true, bool mtaControls = true])

Client

bool toggleAllControls(bool enabled [, bool gtaControls = true, bool mtaControls = true])

Arguments

thePlayerplayer
A player or root (server only).
enabledbool
false = controls blocked.
gtaControlsbool, optional = true
Accepted for compatibility with existing scripts.
mtaControlsbool, optional = true
Accepted for compatibility with existing scripts.

Returns

true on success.

Example

addCommandHandler("zamroz", function(admin, _, name)
    local target = getPlayerFromName(name or "")
    if target then toggleAllControls(target, false) end
end)

See also