- Documentation
- Shared functions
- toggleAllControls
Function
toggleAllControls
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). enabledboolfalse= 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
toggleControlEnables or disables one game control, e.g. shooting (fire), jumping (jump) or entering vehicles (enter_exit). A disabled control ignores the player's keys. On the server you pass a player orroot.isControlEnabledChecks whether a game control is enabled (not blocked withtoggleControlortoggleAllControls).