---
title: "GetRandomVehicleColourPair | open.mp"
description: "获取指定车辆模型的有效随机颜色索引组合"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetRandomVehicleColourPair
language: zh-CN
---

# GetRandomVehicleColourPair

注意

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

## 描述

获取指定车辆模型的有效随机颜色索引组合

## 参数说明

| 参数 | 说明 |
| --- | --- |
| modelid | [车辆模型 ID](https://omp.itsneufox.com/zh-CN/docs/scripting/resources/vehicleid) |
| &colour1 | 存储主颜色索引的变量（引用传递） |
| &colour2 | 存储副颜色索引的变量（引用传递） |
| &colour3 = 0 | 存储第三颜色索引的变量（可选参数，引用传递） |
| &colour4 = 0 | 存储第四颜色索引的变量（可选参数，引用传递） |

## 示例代码

```c
new
	colour1,
	colour2;

// 获取Sultan车型的随机颜色组合（模型ID 560）
GetRandomVehicleColourPair(560, colour1, colour2);
```

## 相关函数

-   [VehicleColourIndexToColour](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/VehicleColourIndexToColour): 将颜色索引转换为 HEX 颜色值（RGBA 格式）
-   [GetVehicleColours](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetVehicleColours): 获取车辆当前颜色配置
