# SKYDIVING

<figure><img src="/files/vdpcVNagKx1qyb6BVIrW" alt=""><figcaption></figcaption></figure>

A comprehensive skydiving script for FiveM that supports both ESX and QBCore frameworks. Experience realistic skydiving adventures with multiple drop zones, customizable pricing, and a beautiful UI.

### 📋 Table of Contents

* Features
* Requirements
* Installation
* Configuration
* Framework Support
* Usage
* Airports & Drop Zones
* Customization
* Dependencies
* Support

### ✨ Features

* **Multi-Framework Support**: Works with both ESX and QBCore
* **Multiple Drop Zones**: 3 pre-configured airports (Sandy Shores, Grapeseed, Cayo Perico)
* **Realistic Flight System**: Dynamic plane routes with multiple waypoints
* **Beautiful UI**: Modern, responsive interface with animations
* **Customizable Pricing**: Set prices for parachutes and flights
* **Multiple Seats**: Multiple players can join the same flight
* **Automatic Drop System**: Players can jump at designated drop zones
* **Pilot Messages**: Immersive pilot announcements during flights
* **Bank & Cash Support**: Payment from both cash and bank accounts

### 📦 Requirements

* **FiveM Server**
* **ESX Legacy** or **QBCore Framework**
* **Lua 5.4**

### 🚀 Installation

1. Download the script and extract it to your `resources` folder
2. Rename the folder to `skydiving`
3. Add this to your `server.cfg`:

   ```cfg
   ensure skydiving
   ```
4. Configure the script in `shared/config.lua` (see Configuration)
5. Restart your server

### ⚙️ Configuration

#### Framework Selection

Open `shared/config.lua` and configure your framework:

```lua
-- For ESX
SkyDiving.Framework = "esx"

-- For QBCore
SkyDiving.Framework = "qbcore"
SkyDiving.ParachuteItem = "parachute" -- Change if your parachute item has a different name
```

#### Basic Settings

```lua
-- Display text when near vendor
SkyDiving.DisplayText = "Press ~r~E~w~ to Fly."

-- Time before departure (in milliseconds)
SkyDiving.TimeBeforeDeparture = 20000 -- 20 seconds

-- Pricing
SkyDiving.ParachutePrice = 550 -- Price per parachute
SkyDiving.FlightPrice = 1500 -- Price per flight
```

#### Old ESX Support

If you're using an old ESX version (below 1.8.5):

```lua
SkyDiving.OldESX = true
SkyDiving.ConfigOldESX = "esx:getSharedObject" -- Change if renamed
```

### 🎮 Framework Support

#### ESX

**Default Configuration:**

* Uses ESX weapon system for parachutes (`GADGET_PARACHUTE`)
* Supports cash and bank payments
* Automatically adds parachute weapon when purchased

**Requirements:**

* ESX Legacy or ESX 1.2+
* Proper ESX exports configured

#### QBCore

**Default Configuration:**

* Uses QBCore item system for parachutes
* Supports cash and bank payments
* ItemBox notifications for item additions

**Requirements:**

* QBCore Framework
* Parachute item configured in your `qb-core/shared/items.lua`

**QBCore Item Setup:**

Add this to your `qb-core/shared/items.lua`:

```lua
['parachute'] = {
    ['name'] = 'parachute',
    ['label'] = 'Parachute',
    ['weight'] = 1000,
    ['type'] = 'item',
    ['image'] = 'parachute.png',
    ['unique'] = false,
    ['useable'] = true,
    ['shouldClose'] = true,
    ['combinable'] = nil,
    ['description'] = 'A parachute for skydiving'
},
```

### 📍 Usage

#### For Players

1. Go to any skydiving location (marked on map with blip)
2. Press **E** when near the vendor
3. Buy a parachute (required before flying)
4. Purchase a flight ticket
5. Wait for the plane to arrive
6. Board the plane and wait for takeoff
7. Jump when the pilot announces it's safe
8. Enjoy your skydive!

#### For Server Owners

* Configure prices in `shared/config.lua`
* Add/remove airports by editing `SkyDiving.Airport` table
* Customize messages in `SkyDiving.Translate` and `SkyDiving.PilotMessage`
* Adjust drop zones by modifying coordinates

### 🛫 Airports & Drop Zones

The script includes 3 pre-configured airports:

#### Sandy Shores

* **Location**: Sandy Shores Airfield
* **Blip**: Available on map
* **Drop Zones**: Multiple locations across the map

#### Grapeseed

* **Location**: Grapeseed Airfield
* **Blip**: Available on map
* **Drop Zones**: Scenic routes over the countryside

#### Cayo Perico

* **Location**: Cayo Perico Island
* **Blip**: Available on map
* **Drop Zones**: Island drop zones

#### Adding Custom Airports

To add a new airport, add this to `SkyDiving.Airport` in `shared/config.lua`:

```lua
["YourAirportName"] = {
    name = "YourAirportName",
    vendorModel = "s_m_m_pilot_01",
    pilotModel = "a_m_m_skidrow_01",
    planeModel = "velum2",
    
    blip = {blipname="SkyDiving", size=0.85, color=27, id=94},
    
    Spawn = vector4(x, y, z, heading),
    Direction1 = vector4(x, y, z, heading),
    Direction2 = vector4(x, y, z, heading),
    Direction3 = vector4(x, y, z, heading),
    DirectionFinal = vector4(x, y, z, heading),
    PreDrop = vector4(x, y, z, heading),
    FirstDrop = vector4(x, y, z, heading),
    LastDrop = vector4(x, y, z, heading),
    Exit = vector4(x, y, z, heading),
    VendorCoords = vector4(x, y, z, heading),
}
```

### 🎨 Customization

#### Translations

Edit `SkyDiving.Translate` to change UI text:

```lua
SkyDiving.Translate = {
    Buy_Parachute = "BUY A PARACHUTE",
    Buy_Button = "BUY",
    Take_Flight = "TAKE A FLIGHT",
    Take_Button = "BUY",
    Close = "CLOSE",
    Success = "TRANSACTION SUCCESSFULLY COMPLETED",
    Success_Name_Para = "Parachute(s)",
    Wrong = "YOU DON'T HAVE ENOUGH MONEY",
    Wrong_Para = "YOU DON'T HAVE A PARACHUTE",
    Wrong_Para_Message = "You have to buy a parachute first",
    Wrong_Fly = "TO FLY"
}
```

#### Pilot Messages

Customize pilot announcements:

```lua
SkyDiving.PilotMessage = {
    TakeOffSoon = '~o~Pilot ~w~"Welcome, We are about to take off, take your seats!"',
    GetOut = '~o~Pilot ~w~"I have other customers waiting for me, I\'m kicking you out!"',
    AllClear = '~o~Pilot ~w~"All is clear now, you can jump!"',
    NoPlace = '~g~Air traffic controller ~w~"Sorry, there is no more seat on the plane, wait for the next flight!"',
    NoFlight = '~g~Air traffic controller ~w~"Sorry, the flight is in progress, the pilot will be back soon!"'
}
```

**Color Codes:**

* `~r~` = Red
* `~g~` = Green
* `~b~` = Blue
* `~y~` = Yellow
* `~o~` = Orange
* `~w~` = White

#### Blip Customization

Edit blip settings for each airport:

```lua
blip = {
    blipname = "SkyDiving", -- Blip name on map
    size = 0.85,            -- Blip size
    color = 27,              -- Blip color
    id = 94                  -- Blip sprite ID
}
```

### 📁 File Structure

```
skydiving/
├── client/
│   ├── client.lua      # Main client logic
│   ├── flight.lua      # Flight mechanics
│   └── functions.lua   # Client utilities
├── server/
│   ├── server.lua      # Main server logic
│   └── function.lua    # Server callbacks
├── shared/
│   └── config.lua      # Configuration file
├── ui/
│   ├── css/            # UI stylesheets
│   ├── js/             # UI JavaScript
│   ├── images/         # UI images
│   ├── sound/          # Sound effects
│   └── index.html      # UI HTML
└── fxmanifest.lua      # Resource manifest
```

### 🔧 Dependencies

* **ESX** or **QBCore** Framework
* **No additional dependencies required**

### 💡 Tips & Tricks

1. **Multiple Players**: The script supports multiple players on the same flight. Players can join until the plane is full.
2. **Automatic Drop**: If players don't jump at the first drop zone, they'll be automatically ejected at the last drop zone.
3. **Flight Timing**: The `TimeBeforeDeparture` setting controls how long players have to board before takeoff.
4. **Custom Routes**: You can create custom flight paths by adjusting the direction waypoints in the airport configuration.

### 🐛 Troubleshooting

#### Script Not Loading

* Check that the resource name matches in `server.cfg`
* Verify all files are in the correct folders
* Check F8 console for errors

#### Framework Not Detected

* Ensure your framework is properly installed
* Check that exports are configured correctly
* Verify `SkyDiving.Framework` is set correctly in config

#### Parachute Not Working (QBCore)

* Ensure the parachute item exists in `qb-core/shared/items.lua`
* Verify `SkyDiving.ParachuteItem` matches your item name
* Check that the item is properly configured as usable

#### UI Not Showing

* Check browser console (F12) for errors
* Verify all UI files are present
* Ensure `ui_page` is correctly configured in `fxmanifest.lua`

### 📄 License

This script is protected by Escrow. The following files are editable:

* `shared/config.lua`
* `server/function.lua`

All other files are protected and cannot be modified.

***

**Enjoy your skydiving adventures!** 🪂✈️


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rex-studio.gitbook.io/rex-studio-docs/fivem-low-cost/skydiving.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
