---
title: "GetVehicleModelCount | open.mp"
description: "获取指定车辆模型的数量。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetVehicleModelCount
language: zh-CN
---

# GetVehicleModelCount

注意

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

## 描述

获取指定车辆模型在服务器上的实例数量。

## 参数

| 参数名 | 说明 |
| --- | --- |
| modelid | 目标[车辆模型](https://omp.itsneufox.com/zh-CN/docs/scripting/resources/vehicleid)的 ID |

## 示例代码

```c
public OnGameModeInit()
{
    CreateVehicle(560, 2112.7607, -1308.3751, 23.6797, 90.0000, -1, -1, 100);
	CreateVehicle(560, 2104.5730, -1308.3313, 23.6797, 90.0000, -1, -1, 100);
	CreateVehicle(560, 2120.3616, -1308.4973, 23.6797, 90.0000, -1, -1, 100);

    new modelid = 560;
    printf("车辆模型：%d - 数量：%d", modelid, GetVehicleModelCount(modelid)); // 车辆模型：560 - 数量：3
}
```

## 相关函数

-   [CreateVehicle](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/CreateVehicle): 创建一辆车辆
-   [GetVehicleModelsUsed](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/GetVehicleModelsUsed): 获取服务器上已使用的车辆模型数量
