Car/ColorPicker.cs

A component attached to a vehicle model that picks a tint color. It requires a ModelRenderer, exposes an array of Colors, chooses a random color on enable for the server/host, and applies it to the renderer. CurrentColor is network-synced.

Networking
using Sandbox;

public sealed class ColorPicker : Component
{
	[RequireComponent] public ModelRenderer ModelRenderer { get; set; }
	[Property] public Color[] Colors { get; set; }

	[Sync] public Color CurrentColor { get; set; }

	protected override void OnEnabled()
	{
		if ( !IsProxy )
		{
			CurrentColor = Game.Random.FromArray( Colors );
		}

		ModelRenderer.Tint = CurrentColor;
	}
}