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..."
 
Kuzkay (talk | contribs)
No edit summary
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Enabled/Disables vehicle nitro function, value can be true or false}}


{{FuncSyntax|AttachVehicleNitro(vehicle [, attach])}}
{{FuncSyntax|AttachVehicleNitro(vehicle [, attach])}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|vehicle |__EDIT_ME__}}
{{FuncParam|vehicle |Vehicle object which you want to attach nitro to}}
{{FuncParamOptional|attach|__EDIT_ME__}}
{{FuncParamOptional|attach|boolean, an true or false value}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function does not return any values}}


== Example ==
== Example ==
__EDIT_ME__
<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}}
__EDIT_ME__
__EDIT_ME__

Revision as of 14:31, 12 August 2019

AttachVehicleNitro

Type: Function
Context: Server
Introduced: v1.0

Description

Enabled/Disables vehicle nitro function, value can be true or false

Syntax

AttachVehicleNitro(vehicle [, attach])

Parameters

  • vehicle
    Vehicle object which you want to attach nitro to
  • attach (optional)
    boolean, an true or false value

Return Value

  • This function does not return any values

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

__EDIT_ME__