---
title: "CreatePlayerGangZone | open.mp"
description: "创建玩家专属帮派区域"
canonical: https://omp.itsneufox.com/zh-CN/docs/scripting/functions/CreatePlayerGangZone
language: zh-CN
---

# CreatePlayerGangZone

注意

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

## 描述

创建玩家独立可见的帮派区域，用于突破全局帮派区域的数量限制。

| 参数 | 说明 |
| --- | --- |
| playerid | 目标玩家 ID |
| Float:minX | 区域西侧边界 X 坐标（最小水平坐标） |
| Float:minY | 区域南侧边界 Y 坐标（最小垂直坐标） |
| Float:maxX | 区域东侧边界 X 坐标（最大水平坐标） |
| Float:maxY | 区域北侧边界 Y 坐标（最大垂直坐标） |

## 返回值

成功返回帮派区域 ID，创建失败返回-1。

## 应用示例

```c
// 使用变量存储玩家帮派区域ID
new gGangZoneID[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    // 创建矩形帮派区域（坐标范围2236.1475,2424.7266至2319.1636,2502.4348）
    gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348);
}
```

```text
                          MaxY
                          ↓
             -------------* < MaxX
             |            |
             |  帮派区域   |
             |   中心点    |
             |            |
      MinX > *-------------
             ↑
             MinY
```

## 注意事项

注意

-   单个玩家最大支持 1024 个帮派区域
-   参数顺序错误会导致区域显示异常

备注

此函数仅创建区域，需调用[PlayerGangZoneShow](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneShow)显示可视化效果

## 关联函数

-   [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): 停止区域闪烁
-   [PlayerGangZoneGetColour](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneGetColour): 获取区域颜色值
-   [PlayerGangZoneGetFlashColour](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneGetFlashColour): 获取闪烁颜色
-   [PlayerGangZoneGetPos](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/PlayerGangZoneGetPos): 获取区域坐标范围
-   [IsValidPlayerGangZone](https://omp.itsneufox.com/zh-CN/docs/scripting/functions/IsValidPlayerGangZone): 验证区域有效性
-   [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): 启用区域进出回调检测

## 辅助工具

-   [Prineside 帮派区域编辑器](https://dev.prineside.com/en/gtasa_gangzone_editor/)
