---
title: "VehicleColourIndexToColour | open.mp"
description: "将车辆颜色索引转换为HEX格式颜色值（RGBA）。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/VehicleColourIndexToColour
language: zh-CN
---

# VehicleColourIndexToColour

注意

这个函数是在omp v1.1.0.2612中添加的，在以前的版本中不起作用！

## 描述

将车辆颜色索引转换为 HEX 格式颜色值（RGBA）。

## 参数

| 参数 | 说明 |
| --- | --- |
| index | [车辆颜色索引](https://omp.itsneufox.com/zh-CN/docs/scripting/resources/vehiclecolorid) |
| alpha = 0xFF | Alpha 通道（默认值为 0xFF） |

## 示例

```c
new colour = VehicleColourIndexToColour(3, 0xFF); // 将索引3转换为不透明度FF的HEX颜色
```

## 相关函数

-   [GetRandomVehicleColourPair](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetRandomVehicleColourPair): 获取指定车辆模型的随机有效颜色索引组合
-   [GetVehicleColours](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetVehicleColours): 获取车辆的主副颜色索引
