RGB: Difference between revisions
From Onset Developer Wiki
No edit summary |
mNo edit summary |
||
Line 16: | Line 16: | ||
<syntaxhighlight lang="Lua"> | <syntaxhighlight lang="Lua"> | ||
AddCommand("colorv", function(playerid, red, green, blue) | AddCommand("colorv", function(playerid, red, green, blue) | ||
if red < 0 or red > 255 or green < 0 or green > | if red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 then | ||
AddPlayerChat(playerid, "Usage: /colorv <red> <green> <blue>") | AddPlayerChat(playerid, "Usage: /colorv <red> <green> <blue>") | ||
end | end |
Revision as of 03:13, 17 November 2019
Description
Returns the RGB hex from the RGB integer.
Syntax
RGB(r, g, b [, a])
Parameters
- r
The red - g
The green - b
The blue - a (optional)
The alpha opacity
Return Value
- Returns the hex color
Example
AddCommand("colorv", function(playerid, red, green, blue)
if red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 then
AddPlayerChat(playerid, "Usage: /colorv <red> <green> <blue>")
end
local vehicleid = GetPlayerVehicle(playerid)
if vehicleid ~= 0 then
AddPlayerChat(playerid, "You must be in a vehicle...")
end
SetVehicleColor(vehicleid, RGB(red, green, blue, 255))
end)