DirkScripts
Docs
disableControls
βΉοΈ Client Module - This can only be used on the client
#Usage
lib.disableControls manages a set of GTA control IDs to disable. It uses reference counting β controls are only disabled while at least one consumer has added them.
lua-- Add controls to the disable set lib.disableControls:Add(1, 2, 3) -- movement controls -- Call every frame to apply (e.g. inside a loop or tick) lib.disableControls() -- Remove specific controls when no longer needed lib.disableControls:Remove(1, 2) -- Clear all disabled controls lib.disableControls:Clear()
#Methods
#:Add(...)
Add control IDs to the disable set.
lualib.disableControls:Add(24, 25, 47, 58) -- combat controls
#:Remove(...)
Remove specific control IDs from the disable set.
lualib.disableControls:Remove(24, 25)
#:Clear(...)
Clear specific or all control IDs. Call with no arguments to clear everything.
lualib.disableControls:Clear() -- clear all lib.disableControls:Clear(47) -- clear specific
#Applying
Call lib.disableControls() (as a function) every frame to actually disable the controls:
luaCreateThread(function() lib.disableControls:Add(1, 2, 3) while someCondition do lib.disableControls() Wait(0) end lib.disableControls:Clear() end)
βΉοΈ Control IDs reference: FiveM Controls β
