Skip to content

Commit

Permalink
use current vehicle colour when opening colour picker
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnFlowerful committed Oct 17, 2016
1 parent 7de6f71 commit bc189ea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 4 additions & 4 deletions [gameplay]/freeroam/colorpicker/colorpicker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ colorPicker = {
70, 15, "Color 1", true, false, colorPicker.GUI.selectWindow)

checkColor2 = guiCreateCheckBox(info.selectWindow.ra2X, info.selectWindow.ra2Y,
70, 15, "Color 2", true, false, colorPicker.GUI.selectWindow)
70, 15, "Color 2", false, false, colorPicker.GUI.selectWindow)

checkColor3 = guiCreateCheckBox(info.selectWindow.ra3X, info.selectWindow.ra3Y,
70, 15, "Color 3", true, false, colorPicker.GUI.selectWindow)
70, 15, "Color 3", false, false, colorPicker.GUI.selectWindow)

checkColor4 = guiCreateCheckBox(info.selectWindow.ra4X, info.selectWindow.ra4Y,
70, 15, "Color 4", true, false, colorPicker.GUI.selectWindow)
70, 15, "Color 4", false, false, colorPicker.GUI.selectWindow)

checkColor5 = guiCreateCheckBox(info.selectWindow.ra5X, info.selectWindow.ra5Y,
75, 15, "Headlights", true, false, colorPicker.GUI.selectWindow)
75, 15, "Headlights", false, false, colorPicker.GUI.selectWindow)

colorPicker.avoidRecursion = false
end,
Expand Down
18 changes: 18 additions & 0 deletions [gameplay]/freeroam/fr_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,24 @@ addCommandHandler('cl', setColorCommand)
function openColorPicker()
editingVehicle = getPedOccupiedVehicle(localPlayer)
if (editingVehicle) then
local r1, g1, b1, r2, g2, b2, r3, g3, b3, r4, g4, b4 = getVehicleColor(editingVehicle, true)
local r, g, b = 255, 255, 255
if (guiCheckBoxGetSelected(checkColor1)) then
r, g, b = r1, g1, b1
end
if (guiCheckBoxGetSelected(checkColor2)) then
r, g, b = r2, g2, b2
end
if (guiCheckBoxGetSelected(checkColor3)) then
r, g, b = r3, g3, b3
end
if (guiCheckBoxGetSelected(checkColor4)) then
r, g, b = r4, g4, b4
end
if (guiCheckBoxGetSelected(checkColor5)) then
r, g, b = getVehicleHeadLightColor(editingVehicle)
end
colorPicker.setValue({r, g, b})
colorPicker.openSelect(colors)
end
end
Expand Down

0 comments on commit bc189ea

Please sign in to comment.