---
title: "existpubvar | open.mp"
description: "检查当前脚本中是否存在特定公共变量。"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/existpubvar
language: zh-CN
---

# existpubvar

## 描述

检查当前脚本中是否存在特定公共变量。

| 参数 | 说明 |
| --- | --- |
| const name\[\] | 要检查的公共变量名称 |

## 返回值

**true** - 变量存在

**false** - 变量不存在

## 相关函数

-   [getpubvar](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/getpubvar): 获取公共变量值
-   [setpubvar](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/setpubvar): 设置公共变量值
-   [numpubvars](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/numpubvars): 统计脚本中公共变量数量
