accessExtraSwitchParams
Provides access to the configuration and live state of a car’s “Extra” switches (Extra A, Extra B, etc.).
It returns an ac.CarExtraSwitchParams object used to simulate inputs or check the availability of these custom controls.
Usage Patterns
Section titled “Usage Patterns”Access the parameters for the “Extra A” switch (Index 0).
local switch = ac.accessExtraSwitchParams(0)Description
Section titled “Description”The ac.accessExtraSwitchParams function is used to interact with the custom interactive elements of a vehicle mod.
These switches are commonly used by vehicle mods to trigger animations such as opening doors, toggling interior lights,
or changing aerodynamic configurations.
The returned structure allows scripts to check whether a switch is active or being held, verify if the switch is available for the current vehicle, and simulate or override the switch state for logic-based triggers.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
index | integer | Yes | The 0-based index of the extra switch to access. |
Return Values
Section titled “Return Values”| Type | Description |
|---|---|
ac.CarExtraSwitchParams | An object providing access to the switch parameters. Returns nil if invalid. |
Examples
Section titled “Examples”Verifying if “Extra A” is actually configured for the current vehicle before running logic.
local extraA = ac.accessExtraSwitchParams(0)
if extraA and extraA.available then ac.log("Extra A is available on this car.")endUsing the access structure to check if a user is currently pressing the Extra B button.
local extraB = ac.accessExtraSwitchParams(1)
function script.update() if extraB and extraB.down then ui.text("Extra B is currently active!") endend