# Texas Holdem

**\~ Made with&#x20;**<mark style="color:red;">**♥**</mark>**&#x20;and used world wide by happy players since 2022 \~**

## <mark style="color:red;">Disclaimer</mark>

This script was developed for a **custom framework** in mind, which has a similar approach on  getting character information (e.g. charecter money, character name) via Events like RedeM:RP (more in compatibility chapter).\
If you intend to use this script with other RedM frameworks, this is however still possible but you eventually need to write a wrapper for the internal events listed in the compatibility chapter to get the required information from your framework to my script and vice versa.

## <mark style="color:red;">Requirements</mark>

* A Framework (<mark style="color:red;">**RedEM:RP, VORP, GUM, RSG-Core, QB-Core**</mark> <mark style="color:red;"></mark>*<mark style="color:red;">or custom framework</mark>*) or script which can provide the following information :
  1. Character Money (get + add+ remove)
  2. Character Name (get full name + first name)
  3. Character Item Check/Removal (get item count and remove item functions)
* RedM Server, forcing 1491 Build for client. Other versions are untested.
* Custom card images (This script will provide a default deck style which imitate the original images from RDR2 but are redone from scratch)
* Script [*<mark style="color:red;">**tm\_modals**</mark>*](https://darksoul.tebex.io/package/5377476) for displaying the rules

## <mark style="color:red;">Features</mark>

* Immersive poker script for RedM - close to RDR2&#x20;
* Set the max amount of money a player can bet each round (Limit / No Limit)
* Card and player animations
* Can be used with the three standard locations (Rhodes, Van Horn, Blackwater) and also on *<mark style="color:red;">**ANY location**</mark>* you like. It includes a custom Object Spawn and Object Deletion mechanism which makes it possible to place custom objects anywhere you like:&#x20;
  * Create a poker table in the moonshine shack beside the piano? **Yep!**&#x20;
  * Clear an area of objects to place a table object and chairs at places which are normally blocked? **Sure!**
  * Use MLO & YMAP mappings with this script! It works that great, that this is the recommended way!
* *<mark style="color:red;">**Highly customizable**</mark>* (NPC, Locations, Blips, Prompts, Holdem Modes, all texts, NUI)
* Spawning card objects for players AND people ***in range***&#x20;
* *<mark style="color:red;">**Compatibility layer**</mark>* to make this script interact with custom or public available frameworks
* Props spawn only when player is nearby to reduce usage of RDR2 object limits and population  density&#x20;
* Up to 6 players per table ***in parallel***.&#x20;
* Sexy animated UI. You can edit it to your needs using CSS/JS
* Usage of general Events due gaming provides other scripts entry points to act on player win/loose or joining/leaving a table:
  * Example: Provide job systems with wins by the dealer to gain income for their company
  * Example: Deactivate metabolism while playing
* <mark style="color:yellow;">**NEW**</mark> Check for Item to access table. E.g. VIP Ticket
* <mark style="color:yellow;">**NEW**</mark> Added Discord webhook for admins to monitor common table interactions
* <mark style="color:yellow;">**NEW**</mark> Reworked & Optimized server side logic to a more object oriented programming
* <mark style="color:yellow;">**NEW**</mark> Reworked & Optimized prompts handling for client side
* <mark style="color:yellow;">**NEW**</mark> Added voice lines per table
* <mark style="color:yellow;">**NEW**</mark> Decide for yourself which chair you want to sit on
* <mark style="color:yellow;">**NEW**</mark> [Added debug mode](/darksouls-script-stash/reference/texas-holdem/background-information.md#table-debug-mode) for creating new table config entries and to get exact mapping coords
* <mark style="color:yellow;">**NEW**</mark> Added more default included frameworks. Currently: Redm:RP, Vorp, Gum, RSG-Core, QB-Core
* <mark style="color:yellow;">NEW</mark> [Adding/Removing](/darksouls-script-stash/reference/texas-holdem/background-information.md#add-remove-table-entries-through-events) table config entries during runtime of the script through events. This allows you to add and remove tables using a menu or command. For example in your casino job

## <mark style="color:red;">Limitations</mark>

The script can use up to 6 different card styles. We have included a custom made deck style to the download folder. For original deck styles, you can visit [RDR3 DISCOVERIES GITHUB](https://github.com/femga/rdr3_discoveries/tree/a63669efcfea34915c53dbd29724a2a7103f822f/useful_info_from_rpfs/textures/ui_minigames/cards)

## <mark style="color:red;">Encryption</mark>

The script itself is mostly encrypted. You can edit the config, webhook and compatibility file for your framework (if needed). Also all GUI related stuff is changeable (HTML/CSS/JS).

## <mark style="color:red;">Installation</mark>

* Copy **d\_texasholdem** into resource folder

{% hint style="danger" %}
The folder name must remain`"d_texasholdem"`. Changes will prevent the script from running properly.&#x20;
{% endhint %}

* Add **ensure d\_texasholdem** to your server config **after** the [<mark style="color:red;">required scripts</mark> ](#2.-requirements)
* If you want to use the original Red Dead Redemtion 2 Poker graphics then you must download it from [here](https://github.com/femga/rdr3_discoveries/tree/a4b4bcd5a3006b0c1434b03e4095d038164932f7/useful_info_from_rpfs/textures/ui_minigames/cards). Place the downloaded graphics under the following path **`d_texasholdem\html\img\cards\`**
* **That's it.** The script should start after a fresh server restart. If you are using txadmin and use the "Resources" Panel in the WebGUI, click "Refresh" and select and start the resource from there.

## <mark style="color:red;">Compatibility</mark>

As mentioned in the disclaimer: This script was written for a (yet) non public roleplay framework in mind which has its root in RedEM:RP. So if you like to make this script compatible with your framework, you would need to take some steps:

#### <mark style="color:red;">Existing (Known) Frameworks:</mark>

| Framework            | Description                                                                   |
| -------------------- | ----------------------------------------------------------------------------- |
| **RedEM:RP**         | Set Config.Framework to "redemrp" or "redemrp2" if you use the newer version  |
| **VORP**             | Set Config.Framework to "vorp" or "vorp2" if you use the newer version        |
| **GUM**              | Set Config.Framework to "gum"                                                 |
| **RSG-Core**         | Set Config.Framework to "rsg"                                                 |
| **QB-Core**          | Set Config.Framework to "qbc"                                                 |
| **other frameworks** | [<mark style="color:red;">see "custom frameworks"</mark>](#custom-frameworks) |

{% hint style="warning" %}
Wen your\`re using RSG-Framework, you have to add the ox\_lib as shared resource into the fxmanifest.lua. Otherwise the notifications wont work

```
shared_scripts {
    '@ox_lib/init.lua',
}
```

{% endhint %}

#### <mark style="color:red;">**Custom Frameworks:**</mark>

* If you are using a custom framework with some fancy own functions and events, you need to use a wrapper event to return or set the required data.&#x20;
* Set Config.Framework to `"custom"` and adapt the wrapper in `public/compatibility.lua`
* You can use the provided wrapper and change it to your needs to communicate correctly with your framework. However I cannot support you when you have trouble getting your custom framework working with my script. If you use a custom framework you should at least know how to properly do this ;)

#### <mark style="color:red;">Custom Framework Wrapper:</mark>

{% code fullWidth="true" %}

```lua
-- Value and functions names obviously differ from what you are using. 
-- In the end my script needs to call the functions within the if statement 
-- to work properly and your framework needs to return the required infos 

-- EXAMPLE CODE:
-- get your framework functions
local Framework = {}
TriggerEvent("getFrameworkCore", function(core) -- <- ADAPT THE EVENT OR REWRITE TO GET YOUR FRAMEWORKS CORE FUNCTIONS
    Framework = core
end)

AddEventHandler("d_texasholdem:custom:getCharacterFromId", function(source, cb)
    local _source = source
    local char = Framework.GetPlayer(_source) -- <- ADAPT THE FUNCTION ON THE RIGHT OF "=" TO RETURN CHARACTER OBJECT
    if char then
        local user = {}
        -- wrapper functions to return and set data from custom framework
        user.getName        = function() return char.data.firstname.." "..char.data.lastname end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO RETURN FULL NAME
        user.getFirstname   = function() return char.data.firstname end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO RETURN FIRSTNAME 
        user.getMoney       = function() return char.func.getMoney(currency) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO RETURN PLAYER MONEY 
        user.removeMoney    = function(amount) char.func.removeMoney(currency, amount) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO REMOVE PLAYER MONEY 
        user.addMoney       = function(amount) char.func.addMoney(currency, amount) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO ADD PLAYER MONEY
        user.getItemAmount  = function(name) return char.inventory.func.getItemCount(name) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO GET PLAYER INVENTORY ITEM AMOUNT
        user.removeItem     = function(name, amount) char.inventory.func.removeItem(name, amount) end -- <- ADAPT THE FUNCTIONS ON THE RIGHT OF "=" TO REMOVE ITEM FROM PLAYER INVENTORY
        cb(user)
    else
        cb(nil)
    end
end)
```

{% endcode %}

## <mark style="color:red;">Telemetry</mark>

For transparency purposes: This asset sends some data for identifying your server to me on startup via a webhook. This includes your server information publicly available by CFX (name, description, owner, etc), IP and script version.

## <mark style="color:red;">Credits</mark>

<mark style="color:red;">@DArkSouL</mark>

<mark style="color:red;">@turbomodus (NUI stuff and base logic for game loop)</mark>


---

# 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://darksouls-script-stash.gitbook.io/darksouls-script-stash/reference/texas-holdem.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.
