# Custom Conditions Example

## PolyZone Example:

Using [PolyZone](https://github.com/mkafrin/PolyZone), you can restrict the use of Parkour. One suggested area is the prison. Let me explain how you can achieve this with the `custom_functions.lua` file.

First, you need to include PolyZone in the manifest file (`fxmanifest.lua`) of kc-parkour. For our example, I will only add the client file since we will be using a PolyZone:

```
client_scripts {
	'@PolyZone/client.lua', -- Here we include PolyZone before anything loads
	'config.lua',
	'client/custom_functions.lua',
	'client/client.lua'
}
```

Then, we can add our custom PolyZone in `custom_functions.lua`. I'm going to use my own prison PolyZone, but you can obviously create your own :

```
local prisonZone = PolyZone:Create({
    vector2(1855.4340820312, 2604.9211425782),
    vector2(1856.2944335938, 2506.7133789062),
    vector2(1769.2734375, 2401.4641113282),
    vector2(1659.9858398438, 2384.1926269532),
    vector2(1529.4373779296, 2464.0905761718),
    vector2(1524.0928955078, 2586.8903808594),
    vector2(1558.0993652344, 2680.6105957032),
    vector2(1640.9311523438, 2764.5512695312),
    vector2(1773.2939453125, 2771.5732421875),
    vector2(1856.2376708984, 2703.5456542968)
    }, {
    name="prison"
})
```

<figure><img src="https://3998953433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbqVdCDZVkocoj3TzhhJO%2Fuploads%2FPUF1Y32zAR4ISKADNbTl%2FFiveM_b2802_GTAProcess_yO05q7pqRG.jpg?alt=media&#x26;token=637d34ec-b725-4d59-b079-8ebcce55feef" alt=""><figcaption><p>You can see here how the PolyZone looks</p></figcaption></figure>

Once the PolyZone has been added, we can do the last step which is adding an `isPointInside`function to, for example, the custom condition `CanBeginParkour` :

```
---This function is called just before initating the parkour move
---@param name string
---@param number number
---@return boolean
function CanBeginParkour(name, number)
    return not prisonZone:isPointInside(GetEntityCoords(PlayerPedId())) -- This checks if the player is in the prison PolyZone or not. if not, he will be able to parkour.
end
```
