---
title: "UsePlayerGangZoneCheck | open.mp"
description: "callback رو وقتی بازیکن وارد/خارج این zone میشه فعال کن"
canonical: https://omp.itsneufox.com/fa/docs/scripting/functions/UsePlayerGangZoneCheck
language: fa
---

# UsePlayerGangZoneCheck

هشدار

This function was added in omp v1.1.0.2612 and will not work in earlier versions!

## توضیحات

callback رو وقتی بازیکن وارد/خارج این zone میشه فعال می‌کنه.

| نام | توضیحات |
| --- | --- |
| playerid | ID بازیکنی که می‌خوای callback رو وقتی وارد/خارج این zone میشه براش فعال کنی. |
| zoneid | ID player-zone ای که می‌خوای تشخیص منطقه براش فعال کنی. |
| bool:enable | آیا تشخیص ورود باید شروع یا متوقف بشه؟ (`true`/`false`) |

## مقدار برگشتی

**true** - تابع با موفقیت اجرا شد.

**false** - تابع اجرا نشد. gangzone مشخص شده وجود نداره.

## مثال‌ها

```c
// This variable is used to store the id of the gangzone
// so that we can use it throught the script
// in variable baraye zakhire id gangzone estefade mishe
// ta betoonim dar tamam script azash estefade konim
new gGangZoneID[MAX_PLAYERS] = {INVALID_GANG_ZONE, ...};

public OnPlayerConnect(playerid)
{
    // Create the gangzone
    // gangzone ro besaz
    gGangZoneID[playerid] = CreatePlayerGangZone(playerid, 2236.1475, 2424.7266, 2319.1636, 2502.4348);

    // Enabled the callback when a player enters/leaves this zone
    // callback ro vaghti player vared/kharej in zone mishe faal kon
    UsePlayerGangZoneCheck(playerid, gGangZoneID[playerid], true);
}

public OnPlayerEnterPlayerGangZone(playerid, zoneid)
{
    if (zoneid == gGangZoneID[playerid])
    {
        new string[64];
        format(string, sizeof(string), "You are entering player gangzone %i", zoneid);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    return 1;
}

public OnPlayerLeavePlayerGangZone(playerid, zoneid)
{
    if (zoneid == gGangZoneID[playerid])
    {
        new string[64];
        format(string, sizeof(string), "You are leaving player gangzone %i", zoneid);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    return 1;
}
```

## Callback های مرتبط

Callback های زیر ممکنه مفید باشن، چون به نحوی با این تابع مرتبط هستن.

-   [OnPlayerEnterPlayerGangZone](https://omp.itsneufox.com/fa/docs/scripting/callbacks/OnPlayerEnterPlayerGangZone): این callback وقتی بازیکن وارد player gangzone میشه فراخوانی میشه.
-   [OnPlayerLeavePlayerGangZone](https://omp.itsneufox.com/fa/docs/scripting/callbacks/OnPlayerLeavePlayerGangZone): این callback وقتی بازیکن از player gangzone خارج میشه فراخوانی میشه.

## توابع مرتبط

توابع زیر ممکنه مفید باشن، چون به نحوی با این تابع مرتبط هستن.

-   [CreatePlayerGangZone](https://omp.itsneufox.com/fa/docs/scripting/functions/CreatePlayerGangZone): player gangzone بساز.
-   [PlayerGangZoneDestroy](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneDestroy): player gangzone رو نابود کن.
-   [PlayerGangZoneShow](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneShow): player gangzone رو نشون بده.
-   [PlayerGangZoneHide](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneHide): player gangzone رو مخفی کن.
-   [PlayerGangZoneFlash](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneFlash): player gangzone رو شروع به چشمک زدن کن.
-   [PlayerGangZoneStopFlash](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneStopFlash): چشمک زدن player gangzone رو متوقف کن.
-   [PlayerGangZoneGetFlashColour](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneGetFlashColour): رنگ چشمک زدن player gangzone رو بدست بیار.
-   [PlayerGangZoneGetColour](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneGetColour): رنگ player gangzone رو بدست بیار.
-   [PlayerGangZoneGetPos](https://omp.itsneufox.com/fa/docs/scripting/functions/PlayerGangZoneGetPos): موقعیت gangzone رو بدست بیار، که با مختصات minX, minY, maxX, maxY نمایش داده میشه.
-   [IsValidPlayerGangZone](https://omp.itsneufox.com/fa/docs/scripting/functions/IsValidPlayerGangZone): چک کن که آیا player gangzone معتبر هست.
-   [IsPlayerInPlayerGangZone](https://omp.itsneufox.com/fa/docs/scripting/functions/IsPlayerInPlayerGangZone): چک کن که آیا بازیکن توی player gangzone هست.
-   [IsPlayerGangZoneVisible](https://omp.itsneufox.com/fa/docs/scripting/functions/IsPlayerGangZoneVisible): چک کن که آیا player gangzone قابل مشاهده هست.
