This is the PREMIUM expansion for the Farpax Spawn Items system. It adds advanced **Presets/Kits** functionality with a complete management system, player sets, and monetization features.
> ⚠️ **IMPORTANT**: This resource is **INDEPENDENT** from the FREE version. You should **NOT** run both resources simultaneously. If the FREE version is detected, a blocking warning will appear.
---
CFX FORUM POST : [PREMIUM]Farpax Spawn Items - Presets/Kits Expansion
## ✨ Features
YOUTUBE VIDEO - [PREMIUM] Farpax Spawn Items - PREMIUM Expansion Presets/Kits
MANAGE PRESETS/KITS:
MANAGE SETS:
### 🎯 Core Features
- **Presets/Kits System**: Create, edit, and manage item presets that players can use
- **Player Sets**: Custom permission system using "sets" instead of traditional groups
- **Advanced Limitations**: Cooldowns and maximum uses per player
- **Item Requirements**: Require specific items to be consumed before using a kit
- **Permission Requirements**: Require specific player sets to use kits
- **Visual Interface**: Beautiful UI with item icons and images
- **Persistent Storage**: All data is saved to JSON files and MySQL database
- **Admin Management**: Complete admin interface for managing presets and player sets
---
## 🚀 Installation
1. **Ensure the FREE version is DISABLED** (if you have it installed)
2. Place this resource in your `resources` folder
3. Add to your `server.cfg`:
```
ensure farpax_spawn_items_en_premium
```
4. The MySQL table for player sets will be created **automatically** on resource start
5. Configure `Config.AllowedGroups` in `config.lua` to set which groups can access admin features
---
## 📖 How It Works
### 🎮 For Players
#### Using Kits
Players can use kits in two ways:
1. **Via Command**:
```
/kit <preset_name>
```
Example: `/kit starterpack`
2. **Via Menu**:
- Open the spawn menu with `/spawnitems` (if admin) or it will show "Kit Spawn" menu
- Go to the **"Presets / Kits"** tab
- Click **"Use Kit"** on any available preset
#### Kit Requirements
Kits can have different requirements:
- **No Requirement**: Anyone can use it
- **Item Requirement**: Player must have a specific item in inventory (it will be consumed)
- **Permission Requirement**: Player must have a specific "set" assigned
#### Kit Limitations
Kits can have limitations:
- **Cooldown**: Player must wait X minutes between uses
- **Max Uses**: Player can only use the kit X times total
> 💡 **Note**: Usage data is **persistent** - it survives server restarts and player relogs.
---
### 👑 For Administrators
#### Creating Presets
1. Open the spawn menu with `/spawnitems`
2. Go to the **"Presets / Kits"** tab
3. Click **"Create Preset"**
4. Fill in the form:
- **Preset Name**: Unique name for the preset
- **Description**: Optional description
- **Items**: Add items with quantities
- **Limitation Type**: Choose "Cooldown" or "Max Uses"
- **Limitation Value**: Set the cooldown time (minutes) or max uses count
- **Requirement Type**: Choose "None", "Item", or "Permission"
- **Requirement Value**: If item/permission, specify the item name or set name
5. Click **"Save Preset"**
#### Editing Presets
1. Open the **"Presets / Kits"** tab
2. Click **"Edit"** on any preset card
3. Modify the fields (name cannot be changed)
4. Click **"Save Preset"**
#### Deleting Presets
1. Open the **"Presets / Kits"** tab
2. Click **"Delete"** on any preset card
3. Confirm the deletion
---
### 🔧 Managing Player Sets
Player sets are custom permission groups that determine which kits a player can see and use.
#### Via Menu (Recommended)
1. Open the spawn menu with `/spawnitems`
2. Go to the **"Manage Sets"** tab
3. You'll see a list of all players (online and offline)
4. For each player:
- **View Sets**: See all sets assigned to the player
- **Add Set**: Type a set name and click **"+"**
- **Remove Set**: Click **"×"** on any set badge
#### Via Command
```
/setkit <action> <charidentifier> [set_name]
```
**Actions**:
- `list <charidentifier>` - List all sets for a character
- `add <charidentifier> <set_name>` - Add a set to a character
- `remove <charidentifier> <set_name>` - Remove a set from a character
**Examples**:
```
/setkit list 58
/setkit add 58 vip1
/setkit add 58 vip2
/setkit remove 58 vip1
```
> 💡 **Note**: `<charidentifier>` is the **character ID**, not the server ID. You can find it in the "Manage Sets" tab.
---
## 🎨 Visual Features
### Item Icons
- **Kit Items**: All items in a kit display their icons
- **Required Items**: If a kit requires an item, the item icon is shown
- **Visual Cards**: Each item appears in a styled card with its image
### Interface
- **Modern Design**: Western-themed UI matching RedM aesthetic
- **Responsive**: Works well with different screen sizes
- **Intuitive**: Easy to understand and navigate
---
## 📁 File Structure
```
farpax_spawn_items_en_premium/
├── config.lua # Configuration file
├── fxmanifest.lua # Resource manifest
├── server/
│ ├── server.lua # Main server logic
│ └── presets_server.lua # Presets and sets management
├── client/
│ ├── client.lua # Main client logic
│ └── presets_client.lua # Presets client handlers
└── html/
├── index.html # Main UI
├── script.js # Main UI logic
├── presets_ui.js # Presets UI logic
└── style.css # Styling
```
---
## 💾 Data Storage
### JSON Files
- `presets.json`: Stores all preset configurations
- `preset_usage.json`: Stores player usage data (cooldowns, uses)
### MySQL Table
- `farpax_player_sets`: Stores player sets (created automatically)
---
## ⚙️ Configuration
### Admin Groups
Edit `Config.AllowedGroups` in `config.lua`:
```lua
Config.AllowedGroups = {
"admin",
"superadmin",
"owner"
}
```
### Preset Command
Change the kit command in `config.lua`:
```lua
Config.Presets = {
command = "kit", -- Change this to your preferred command
-- ...
}
```
---
## 🔒 Security Features
### Server-Side Validation
- All preset operations are validated on the server
- Player permissions are checked server-side
- Usage data is tracked server-side to prevent bypassing
### Protection Against Bypass
- Usage data persists across restarts
- Cooldowns and max uses cannot be bypassed by relogging
- All checks are performed server-side
---
## 📝 Usage Examples
### Example 1: Starter Kit
**Create a preset**:
- Name: `starterpack`
- Items: `bread x5`, `water x3`, `bandage x2`
- Limitation: Cooldown 60 minutes
- Requirement: None
**Result**: Players can use `/kit starterpack` once per hour to get starter items.
### Example 2: VIP Kit with Item Requirement
**Create a preset**:
- Name: `vipkit`
- Items: `goldbar x1`, `money x1000`
- Limitation: Max uses 3
- Requirement: Item `vipcard`
**Result**: Players with a `vipcard` item can use this kit up to 3 times. The `vipcard` will be consumed each time.
### Example 3: Set-Based Kit
**Create a preset**:
- Name: `premiumkit`
- Items: `weapon_revolver x1`, `ammo x50`
- Limitation: Cooldown 120 minutes
- Requirement: Permission `vip1`
**Assign set to player**:
```
/setkit add 58 vip1
```
**Result**: Only players with the `vip1` set can see and use this kit.
---
## 🐛 Troubleshooting
### Menu Not Opening
- Ensure the FREE version is **disabled**
- Check server console for errors
- Verify you have the correct admin group
### Kits Not Appearing
- Check if the preset has a requirement (item/permission)
- Verify the player has the required set (if permission-based)
- Check server console for errors
### Sets Not Saving
- Verify MySQL is running
- Check if the `farpax_player_sets` table exists
- Check server console for MySQL errors
### UI Freezing
- Use the emergency command: `/closespawnmenu`
- Check browser console (F12) for JavaScript errors
- Restart the resource if needed
---
## 📞 Support
For issues, questions, or feature requests, please contact the developer or visit the Tebex store.
**Tebex Store**: https://farpa-tools.tebex.io/category/2984404
---
## 📄 License
This is a premium resource. Unauthorized distribution or modification is prohibited.
---
## 🎉 Enjoy!
Thank you for purchasing the PREMIUM expansion. Enjoy the advanced features and happy spawning! 🎁