# mad-magic8ball

## Link

{% embed url="<https://madcap-scripts.tebex.io/package/mad-magic8ball>" %}
Tebex package
{% endembed %}

***

## Introduction

A FiveM resource that adds a Magic 8 Ball item to your server, complete with a 3D model, animations, and customizable responses.

### Preview

Watch the [preview video](https://youtu.be/yCrsZ-HUc28) to see mad-magic8ball in action, or view the screenshots below.

{% embed url="<https://youtu.be/yCrsZ-HUc28>" %}
mad-magic8ball YouTube preview
{% endembed %}

<div><figure><img src="https://737274200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1US2IqenUQWypVR7rbp2%2Fuploads%2FtHPVXkD3kri9p2mhkCxp%2F1.png?alt=media&#x26;token=e8281ee5-435f-4751-8e1c-cb8c7746f9c5" alt=""><figcaption></figcaption></figure> <figure><img src="https://737274200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1US2IqenUQWypVR7rbp2%2Fuploads%2FcJ8lfo5Gj4eI7CGJaepH%2F2.png?alt=media&#x26;token=59bb97c9-8024-4890-8f9f-3129649d1da3" alt=""><figcaption></figcaption></figure> <figure><img src="https://737274200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1US2IqenUQWypVR7rbp2%2Fuploads%2FA2y50G2r6piwpUdeWZ2S%2F3.png?alt=media&#x26;token=d184f632-ffa1-471f-a331-d5b8970e376f" alt=""><figcaption></figcaption></figure> <figure><img src="https://737274200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1US2IqenUQWypVR7rbp2%2Fuploads%2F0pD7WognlRbkuiqLzq1F%2F4.png?alt=media&#x26;token=398974a6-e923-43b7-a837-6de4640d0f01" alt=""><figcaption></figcaption></figure></div>

***

## Features

* 🎱 Interactive 3D Magic 8 Ball model with realistic animations and prop
* ✒️ Customizable responses
* 🎒 Item usable from inventory
* 📢 Command to use the Magic 8 Ball without needing the item
* 👨‍💻 Configurable settings

***

## How to Use

#### As an Item

The Magic 8 Ball can be used as an inventory item. The item name is configurable in `config.lua`.

1. Players can use the Magic 8-Ball item from their inventory
2. When used, a 3D Magic 8-Ball will appear on screen
3. Click on the ball to shake it and receive a random prediction
4. Press ESC to close the UI

#### Using a Command

You can also use the Magic 8 Ball via a command:

* Default command: `/magic8ball`

***

## Dependencies

* [ox\_lib](https://github.com/overextended/ox_lib)

***

## Supports

* qb-inventory
* ox\_inventory
* any other inventories - follow the instructions below&#x20;

***

## Installation

1. Ensure you have the required dependency
2. Place the folder in your server's resources directory
3. Add `start mad-magic8ball` to your server.cfg
4. Configure the `config.lua` file to match your server's needs
5. If using the item, follow the instructions below

### Adding the Item to Inventory

An item image is included in the INSTALL directory. Add this to your inventory's web image folder.

#### For QB-Core/QB-Inventory

Add the item to your `qb-core/shared/items.lua` file:

```lua
magic8ball = { name = 'magic8ball', label = 'Magic 8-Ball', weight = 100, type = 'item', image = 'magic8ball.png', unique = false, useable = true, shouldClose = true, description = "Ask it a question and shake for answers to life's mysteries."},
```

#### For ox\_inventory

Add the following to your `ox_inventory/data/items.lua` file:

```lua
['magic8ball'] = {
    label = 'Magic 8-Ball',
    weight = 100,
    stack = true,
    close = true,
    description = "Ask it a question and shake for answers to life's mysteries.",
    client = {
        export = 'mad-magic8ball.magic8ball'
    }
},
```

#### For Other Inventory Systems

If you're using a another inventory system, you can integrate the Magic 8 Ball by triggering the client event:

```lua
-- Server-side: When your inventory system handles item usage
RegisterServerEvent('your-inventory:useItem')
AddEventHandler('your-inventory:useItem', function(itemName)
    local src = source
    if itemName == 'magic8ball' then
        TriggerClientEvent('mad-magic8ball:use', src)
    end
end)
```

```lua
-- Client-side: Alternative integration method
-- Call this function when your inventory item is used
function YourInventory.UseItem(itemName)
    if itemName == 'magic8ball' then
        TriggerEvent('mad-magic8ball:use')
    end
end
```

***

## Configuration

All settings can be found in `config.lua`:

<figure><img src="https://737274200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1US2IqenUQWypVR7rbp2%2Fuploads%2FGJgrDuhYqBoblFVkskZf%2Fcarbon-8ball.png?alt=media&#x26;token=9c837a95-787e-4168-a96c-f1eb0c79fded" alt=""><figcaption><p>mad-magic8ball config</p></figcaption></figure>

***

## Support

Join our [Discord community](https://discord.gg/dTNWpmPGyc) for support, regular updates and to request new features.

***

\
**Escrow Protection**

This resource is protected by FiveM's escrow system to safeguard against unauthorised distribution. The core functionality is secured while maintaining full customisability through the extensive configuration system.

Despite the security measures:

* All configuration options remain **fully editable.**
* Server owners retain **complete control** over all settings.
* **No functionality is limited** by the protection system.

This approach ensures you receive a premium, leak-protected resource while maintaining the freedom to customise it for your server's unique needs.


---

# 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://madcap.gitbook.io/docs/premium-resources/mad-magic8ball.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.
