AttachVehicleNitro

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
AttachVehicleNitro

Type: Function
Context: Server
Introduced: v1.0

Description

Enables/Disables vehicle nitro function.

Syntax

AttachVehicleNitro(vehicle [, attach])

Parameters

  • vehicle
    Vehicle identifier which you want to attach nitro to.
  • attach (optional)
    boolean, a true or false value

Return Value

  • This function does not return any value.

Example

function ToggleNitro(player)
	--Gets vehicle player is currently driving
	local vehicle = GetPlayerVehicle(player)
	
	--make sure vehicle is not equal to 0
	if vehicle ~= 0 then
		--enable nitro + print a message on the chat
		AttachVehicleNitro(vehicle, true)
		
		AddPlayerChat(player, "Nitro has been enabled")
	else
		--vehicle was equal to 0 and vehicle was not found, print an error message on the chat
		AddPlayerChat(player, "You must be in a vehicle to enable nitro")
	end
	
end

See also