GetVehicleLightState: Difference between revisions
From Onset Developer Wiki
No edit summary |
FlyingFork (talk | contribs) |
||
Line 11: | Line 11: | ||
== Example == | == Example == | ||
AddCommand("lights", function(playerid) | |||
local vehicle = GetPlayerOccupiedVehicle(playerid) | |||
if vehicle == 0 then | |||
return AddPlayerChat(playerid, "You must be in a vehicle!") | |||
end | |||
local state = not GetVehicleLightEnabled(vehicle) | |||
SetVehicleLightEnabled(vehicle, state) | |||
return AddPlayerChat(playerid, "Vehicle headlights changed to: " .. (state and "on" or "off") .. "!") | |||
end) | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{Template:VehicleFunctions}} | {{Template:VehicleFunctions}} |
Revision as of 16:06, 27 May 2021
Description
Get the vehicle's light state.
Syntax
GetVehicleLightState(vehicle)
Parameters
- vehicle
The vehicle identifier.
Return Value
- Returns true on success.
Example
AddCommand("lights", function(playerid)
local vehicle = GetPlayerOccupiedVehicle(playerid) if vehicle == 0 then return AddPlayerChat(playerid, "You must be in a vehicle!") end
local state = not GetVehicleLightEnabled(vehicle) SetVehicleLightEnabled(vehicle, state) return AddPlayerChat(playerid, "Vehicle headlights changed to: " .. (state and "on" or "off") .. "!")
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