Premium water trapping system for RedM (supports VORP Core framework).
# NEXTCODE-Trap | Premium Trapping System
* [🇹🇭 ภาษาไทย (Thai)](#-ภาษาไทย-thai)
* [🇬🇧 English](#-english)
---
## 🇹🇭 ภาษาไทย (Thai)
ระบบวางกับดักจับสัตว์น้ำ (Trap System) สำหรับ RedM (รองรับ VORP Core)
### 📌 คุณสมบัติ (Features)
-
**ระบบพื้นที่วางกับดัก:** รองรับการวางแบบทุกแหล่งน้ำ (Global Water Placement) หรือกำหนดพื้นที่เฉพาะด้วย PolyZones
-
**ระบบแบล็คลิสต์พื้นที่:** สามารถตั้งค่าห้ามวางกับดักในบริเวณเมืองที่กำหนดได้ (Blacklisted Towns)
-
**ระบบคู่เหยื่อและกับดัก:** กำหนดไอเทมกับดักให้สอดคล้องกับไอเทมเหยื่อได้อย่างอิสระ (เช่น `trap_cylinderwood` คู่กับ `bait_crab_shrimp`)
-
**ระบบสุ่มไอเทม (Loot Table):** สามารถตั้งค่าโอกาสดรอป (%) และจำนวนไอเทมที่ได้รับแยกตามประเภทของกับดัก
-
**รอบการสุ่มของรางวัล:** กำหนดระยะเวลารอคอยในแต่ละรอบ (Loot Interval) (ค่าเริ่มต้น 5 นาที)
-
**อายุการใช้งานกับดัก:** กับดักมีระยะเวลาพังหรือหมดอายุ (Trap Lifetime) (ค่าเริ่มต้น 2 ชั่วโมง)
-
**การจำกัดจำนวน:** กำหนดจำนวนกับดักสูงสุดที่ผู้เล่นสามารถวางได้ (Max Trap Per Player)
-
**แจ้งเตือน Discord (Webhook):** รองรับการบันทึก Log การกระทำต่างๆ ส่งเข้า Discord อย่างสวยงาม
-
**ระบบ Blip อัจฉริยะ:** ไอคอนบนแผนที่จะเปลี่ยนรูปแบบและชื่อเมื่อกับดักพร้อมให้เก็บเกี่ยว
-
**ระบบแอดมิน:** กำหนดสิทธิ์ Admin group ในการจัดการกับดักได้
### ⚙️ การติดตั้ง (Installation)
1. นำโฟลเดอร์ `NEXTCODE-Trap` (ที่ได้มาจากการดาวน์โหลด) ไปใส่ในโฟลเดอร์ `resources` ของเซิร์ฟเวอร์
2. ทำการรันไฟล์ฐานข้อมูล `sql.sql` เพื่อสร้างตารางบันทึกกับดัก และ `items.sql` เพื่อเพิ่มไอเทมทั้งหมดที่จำเป็นเข้าสู่ Database ของคุณ
3. เพิ่มชื่อสคริปต์ในไฟล์ `server.cfg` ของเซิร์ฟเวอร์:
```cfg
ensure NEXTCODE-Trap
```
4. (ตัวเลือก) คุณสามารถตรวจสอบหรือแก้ไขชื่อและรายละเอียดของไอเทมได้ในไฟล์ `items.sql` ก่อนรัน หรือดูชื่อไอเทมที่ใช้จาก `config.lua`
### 🛠️ การตั้งค่าที่สำคัญ (Configuration)
คุณสามารถปรับแต่งระบบให้เข้ากับเซิร์ฟเวอร์ของคุณได้ที่ไฟล์ `config.lua`:
- `Config.UseGlobalWaterPlacement` - เปิด/ปิด การวางกับดักในน้ำแบบอัตโนมัติ
- `Config.TrapBait` - จัดการคู่ไอเทมกับดักและเหยื่อ
- `Config.LootTable` - จัดการไอเทม, เปอร์เซ็นต์การดรอป และจำนวนที่ได้รับ
- `Config.DiscordWebhook` - ใส่ลิงก์ Discord Webhook สำหรับเก็บ Log
- `Config.AdminGroups` - กลุ่มแอดมินที่สามารถใช้งานระบบจัดการได้
### 📜 ความต้องการของระบบ (Requirements)
- [VORP Core](https://github.com/VORPCORE/vorp_core)
- [oxmysql](https://github.com/overextended/oxmysql)
---
## 🇬🇧 English
Premium water trapping system for RedM (supports VORP Core framework).
### 📌 Features
-
**Placement System:** Supports global water placement anywhere or restricted placement using PolyZones.
-
**Blacklisted Areas:** Ability to disable trap placement in specific towns or areas.
-
**Bait & Trap Pairing:** Flexibly link trap items with specific bait items (e.g., `trap_cylinderwood` requires `bait_crab_shrimp`).
-
**Loot Table System:** Configure drop chances (%) and item quantities separately for each type of trap.
-
**Harvest Interval:** Define the waiting time before a trap yields loot (default: 5 minutes).
-
**Trap Lifetime:** Traps have a durability/expiration timer (default: 2 hours).
-
**Trap Limits:** Set the maximum number of traps a single player can deploy at once.
-
**Discord Webhooks:** Comprehensive action logging sent directly to your Discord server.
-
**Smart Blips:** Map icons dynamically change their appearance and name when a trap is ready to be harvested.
-
**Admin System:** Define admin groups with permissions to manage and clear traps.
### ⚙️ Installation
1. Move the downloaded `NEXTCODE-Trap` folder into your server's `resources` directory.
2. Execute the provided `sql.sql` (to create the traps table) and `items.sql` (to add all required items) into your server's database.
3. Ensure the script in your `server.cfg` file:
```cfg
ensure NEXTCODE-Trap
```
4. (Optional) You can verify or edit item names and details in the `items.sql` file before executing, or check the required item names inside `config.lua`.
### 🛠️ Important Configuration
You can customize the script to fit your server's needs in the `config.lua` file:
- `Config.UseGlobalWaterPlacement` - Enable/Disable automatic global water placement detection.
- `Config.TrapBait` - Manage the required bait for each trap type.
- `Config.LootTable` - Manage the reward items, drop percentages, and quantities.
- `Config.DiscordWebhook` - Insert your Discord Webhook URL for logs.
- `Config.AdminGroups` - Groups allowed to use admin features.
### 📜 Requirements
- [VORP Core](https://github.com/VORPCORE/vorp_core)
- [oxmysql](https://github.com/overextended/oxmysql)
---
*Developed by NEXTCODE (Version 1.1.0)*