Skip to content

Easzy's Tuning - Custom Checks

This guide explains how to use the customCheck function to control access to tuning categories in Easzy's Tuning.


1. What is a Custom Check?

Each category defined in categories.lua can include a customCheck function.

This function controls: - Whether a player can buy items from the category. - Whether the category is visible to the player.


2. Function Syntax

customCheck = function(ply)
    return canAccess, showCategory
end
````

* `ply`: the player object.
* `canAccess`: (boolean) allows or denies access to the category content.
* `showCategory`: (boolean) controls whether the category is visible at all.

---

## 3. Allow All Players

```lua
customCheck = function(ply)
    return true, true
end

Everyone can see and access this category.


4. VIP Only (Visible with Lock Icon)

customCheck = function(ply)
    return easzy.tuning.IsPlayerVIP(ply)
end

Non-VIPs will see the category but it will be locked. Only VIPs can use it.

This is equivalent to:

customCheck = function(ply)
    local isVIP = easzy.tuning.IsPlayerVIP(ply)
    return isVIP, true
end

5. VIP Only (Completely Hidden)

customCheck = function(ply)
    local isVIP = easzy.tuning.IsPlayerVIP(ply)
    return isVIP, isVIP
end

The category is completely hidden for non-VIP players.


6. Custom Logic Example

customCheck = function(ply)
    return ply:Team() == TEAM_MECHANIC, true
end

Only players with the "Mechanic" job can access this category.


7. Need Help?

If you're unsure how to write a custom check for your use case, feel free to contact support on Discord.