AttachVehicleNitro: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|AttachVehicleNitro(vehicle [, attach])}} {{FuncParameters}} {{FuncParam|vehicle |__EDIT_ME__}} {{F..." |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Enables/Disables vehicle nitro function.}} | ||
{{FuncSyntax|AttachVehicleNitro(vehicle [, attach])}} | {{FuncSyntax|AttachVehicleNitro(vehicle [, attach])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|vehicle | | {{FuncParam|vehicle |Vehicle identifier which you want to attach nitro to.}} | ||
{{FuncParamOptional|attach| | {{FuncParamOptional|attach|boolean, a true or false value}} | ||
{{FuncReturnValue| | {{FuncReturnValue|This function does not return any value.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
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 | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{VehicleFunctions}} |
Latest revision as of 17:12, 13 December 2019
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
- CreateVehicle
- DestroyVehicle
- IsValidVehicle
- GetVehicleCount
- GetAllVehicles
- GetVehicleModel
- GetVehicleModelName
- SetVehicleRespawnParams
- IsVehicleStreamedIn
- GetStreamedVehiclesForPlayer
- GetStreamedVehicles
- SetVehicleLocation
- GetVehicleLocation
- SetVehicleRotation
- GetVehicleRotation
- SetVehicleHeading
- GetVehicleHeading
- SetVehicleHealth
- GetVehicleHealth
- SetVehicleLicensePlate
- GetVehicleVelocity
- GetVehicleDriver
- GetVehiclePassenger
- GetVehicleNumberOfSeats
- SetVehicleColor
- GetVehicleColor
- SetVehicleLinearVelocity
- SetVehicleAngularVelocity
- GetVehicleGear
- SetVehicleHoodRatio
- GetVehicleHoodRatio
- SetVehicleTrunkRatio
- GetVehicleTrunkRatio
- StartVehicleEngine
- StopVehicleEngine
- GetVehicleEngineState
- SetVehicleLightEnabled
- GetVehicleLightState
- SetVehicleDamage
- GetVehicleDamage
- AttachVehicleNitro