SetVehicleColor: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
{{FuncDescription|Sets the color of a given vehicle.}} | {{FuncDescription|Sets the color of a given vehicle.}} | ||
{{FuncSyntax|SetVehicleColor(vehicle, | {{FuncSyntax|SetVehicleColor(vehicle, IntColor)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|vehicle|The vehicle to change the color of.}} | {{FuncParam|vehicle|The vehicle to change the color of.}} | ||
{{FuncParam| | {{FuncParam|IntColor|The color as an integer. Use [[RGB]] to convert RGB codes to int.}} | ||
{{FuncReturnValue|Returns '''true''' on success, '''false''' on error.}} | {{FuncReturnValue|Returns '''true''' on success, '''false''' on error.}} | ||
Line 29: | Line 29: | ||
SetVehicleColor(vehicle, RGB(r, g, b)) | SetVehicleColor(vehicle, RGB(r, g, b)) | ||
AddPlayerChat(player, "New vehicle color set ( | AddPlayerChat(player, "New vehicle color set (Integer color: "..GetVehicleColor(vehicle)..")") | ||
end | end | ||
AddCommand("vcolor", cmd_vcolor) | AddCommand("vcolor", cmd_vcolor) |
Latest revision as of 20:39, 30 August 2020
Description
Sets the color of a given vehicle.
Syntax
SetVehicleColor(vehicle, IntColor)
Parameters
- vehicle
The vehicle to change the color of. - IntColor
The color as an integer. Use RGB to convert RGB codes to int.
Return Value
- Returns true on success, false on error.
Example
function cmd_vcolor(player, r, g, b)
if (r == nil or g == nil or b == nil) then
return AddPlayerChat(player, "Usage: /vcolor <r> <g> <b>")
end
local vehicle = GetPlayerVehicle(player)
if (vehicle == 0) then
return AddPlayerChat(player, "You must be in a vehicle")
end
if (GetPlayerVehicleSeat(player) ~= 1) then
return AddPlayerChat(player, "You must be the driver of the vehicle")
end
SetVehicleColor(vehicle, RGB(r, g, b))
AddPlayerChat(player, "New vehicle color set (Integer color: "..GetVehicleColor(vehicle)..")")
end
AddCommand("vcolor", cmd_vcolor)
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