OnPlayerToggleVehicleNitro

From Onset Developer Wiki
OnPlayerToggleVehicleNitro

Type: Event
Context: Client
Introduced: v1.2.0

Description

Called when a (local) player presses the key to turn nitro on/off. You can return false to prevent turning it on. Requires AttachVehicleNitro to be enabled on the vehicle.

Syntax

OnPlayerToggleVehicleNitro(vehicle, toggle)
  • vehicle
    The vehicle identifier.
  • toggle
    true if the player will turn on nitro, false otherwise.

Example

AddEvent("OnPlayerToggleVehicleNitro", function(vehicle, toggle)
    if toggle == true then
        return false -- do not allow the player to turn on the nitro
    end
end)

See also