Skip to main content

SetButtonPressed

This function was added in DSL 5

Description

Set a button as pressed.

This function is intended to be called during a ControllerUpdating event. Calling it at any other time may produce unexpected results. This is often a good way of disabling a specific button on a specific controller.

function SetButtonPressed(button, controller, pressed) --[[ ... ]] end

Parameters

  • button: integer - The button ID to set as pressed.
  • controller: 0|1|2|3 - The controller to set the button on.
  • pressed: boolean - Whether to set the button as pressed or not. If true, the button will be considered pressed, if false, it will be considered not pressed.

Return Values

None.

Example

Disable the sprint button for all controllers.

RegisterLocalEventHandler('ControllerUpdating', function(controller)
SetButtonPressed(7, controller, false)
end)

See Also