---
title: "IsValidPlayerGangZone | open.mp"
description: "检测玩家帮派区域有效性"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/IsValidPlayerGangZone
language: zh-CN
---

# IsValidPlayerGangZone

注意

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

## 描述

检测指定玩家的帮派区域是否有效。

| 参数名 | 说明 |
| --- | --- |
| playerid | 绑定的玩家 ID |
| zoneid | 要检测的玩家帮派区域 ID |

## 返回值

**true** - 帮派区域有效

**false** - 帮派区域无效

## 示例代码

```c
// 用于存储帮派区域ID的变量
new gGangZoneID[MAX_PLAYERS] = {INVALID_GANG_ZONE, ...};

public OnPlayerConnect(playerid)
{
    // 创建玩家专属帮派区域
    gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348);
}

public OnPlayerSpawn(playerid)
{
    // 检测帮派区域有效性
    if (IsValidPlayerGangZone(playerid, gGangZoneID[playerid]))
    {
        PlayerGangZoneDestroy(playerid, gGangZoneID[playerid]);
        gGangZoneID[playerid] = INVALID_GANG_ZONE;
    }
}
```

## 相关函数

-   [CreatePlayerGangZone](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/CreatePlayerGangZone): 创建玩家专属帮派区域
-   [PlayerGangZoneDestroy](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneDestroy): 销毁玩家帮派区域
-   [PlayerGangZoneShow](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneShow): 显示玩家帮派区域
-   [PlayerGangZoneHide](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneHide): 隐藏玩家帮派区域
-   [PlayerGangZoneFlash](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneFlash): 启动帮派区域闪烁
-   [PlayerGangZoneStopFlash](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneStopFlash): 停止帮派区域闪烁
-   [PlayerGangZoneGetFlashColour](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneGetFlashColour): 获取闪烁颜色值
-   [PlayerGangZoneGetColour](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneGetColour): 获取基础颜色值
-   [PlayerGangZoneGetPos](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneGetPos): 获取区域坐标范围
-   [IsPlayerInPlayerGangZone](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/IsPlayerInPlayerGangZone): 检测玩家是否在区域中
-   [IsPlayerGangZoneVisible](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/IsPlayerGangZoneVisible): 检测区域可见性
-   [IsPlayerGangZoneFlashing](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/IsPlayerGangZoneFlashing): 检测闪烁状态
-   [UsePlayerGangZoneCheck](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/UsePlayerGangZoneCheck): 启用区域进出检测回调
