> For the complete documentation index, see [llms.txt](https://titans-productions.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titans-productions.gitbook.io/documentation/redm/how-to-update-scripts.md).

# How to update scripts

1. Through Discord (if you are part of it), you will receive a tag in the **script-updates** channel. In case you are not, you will receive a notify on txadmin that the script is outdated and you must search on our [Github](https://github.com/TitansProductions) the script and find the update log.
2. If you are in our discord, the tag will contain a link that opens **GitHub**, where you will be informed about how to perform the update. It will tell you which files need to be replaced and what needs to be added to the **config / locales** files, if changes have been made to those files (or more).
3. Check the **Modified Files** section. This will show you which files have been updated. For example:

```
Modified Files:
    - server/tp-server_callbacks.lua
    - config.lua (CHECK NOTES)
    - fxmanifest.lua
```

4. This means that you should download the script again from **CFX Assets** and replace the old files with the new files listed under **Modified Files**.<br>

   **IMPORTANT:** If `locales.lua` / configuration files are listed (even escrowed files), **DO NOT REPLACE THEM**, otherwise you will lose everything you have customized!

   Instead, check the **Notes** section, as it will tell you exactly what changes you need to make manually.
5. Once you have replaced the required files, the system have received the update. However, you must pay special attention to the **Notes** section directly below it.If the **Notes** section contains instructions, it is **very important that you follow them**. Otherwise, the script may not work correctly.<br>

   The Notes section contains changes that you need to make yourself because **CFX Assets does not automatically update these parts of your script**.

   All of these changes must be done **manually by you**.

**For example:**

1. Add the new database table column to `tp_player_stores`:

```sql
ALTER TABLE `tp_player_stores`
ADD COLUMN IF NOT EXISTS `blip_sprite` INT(14) DEFAULT 0;
```

2. Add the new configuration option to `config.lua`:

```lua
-- In case the selection of blips is disabled, this is the default blip sprite.
Config.DefaultBlipSprite = 819673798 -- version 3.1.2
```

3. Add the new configuration button option to `Config.ManagementMenu` in `config.lua`:

```lua
{ Type = 'MENU_MAIN_BLIP_SPRITE', Enabled = true }, -- sets the blip sprite of the store (version 3.1.2)
```

### Example (1)

You are instructed to add a new data column to the `tp_player_stores` database table.

Whenever I mention that something needs to be added to the **database**, you should open **HeidiSQL**, go to **Query**, copy/paste the provided SQL query, and **Execute** it.

***

### Example (2)

You are instructed to add a new option to `config.lua` — this is very easy.

Simply copy/paste the new option into a location that **does NOT interfere with any other option**, meaning there should be an empty space between the options where you can safely add it.

***

### Example (3)

You are instructed to add a new option to `config.lua`, **BUT** the option needs to be added inside an already existing option, such as `Config.ManagementMenu`.

In this case, you need to place the new option **inside the existing configuration**.

For example:

**Look at the comments:**\
`(<-------------- THIS IS WHAT WE ADDED. THE POSITION DOES NOT MATTER; IT CAN BE THE FIRST OR THE LAST OPTION.)`

```lua
-- Options in the management menu to display / not based on your personal and server preferences.
-- (!) DO NOT MODIFY THE TYPE NAMES.
Config.ManagementMenu = {
  { Type = 'MENU_MAIN_NAME',        Enabled = true }, -- sets the name of the store.
  { Type = 'MENU_MAIN_DESCRIPTION', Enabled = true }, -- sets the description of the store.
  { Type = 'MENU_MAIN_WITHDRAW',    Enabled = true }, -- withdraw money from the store ledger.
  { Type = 'MENU_MAIN_DEPOSIT',     Enabled = true }, -- deposit money on the store ledger.
  { Type = 'MENU_MAIN_MEMBERS',     Enabled = true }, -- manage the members and their permissions.
  { Type = 'MENU_MAIN_STORAGE',     Enabled = true }, -- open storage (tp containers supported)
  { Type = 'MENU_MAIN_BLIP_SPRITE', Enabled = true }, -- sets the blip sprite of the store (version 3.1.2) <-------------- THIS IS WHAT WE ADDED. THE POSITION DOES NOT MATTER; IT CAN BE THE FIRST OR THE LAST OPTION.
  { Type = 'MENU_MAIN_TOGGLE',      Enabled = true }, -- toggles the store as open or closed. (version 3.0.5)
}
```

## IMPORTANT

You must **always check the version difference** between your current version and the latest version.

For example, if you have version `3.0.9` and the latest version is `3.1.2`, this means that you are **3 versions behind**.

In this case, you must check the **GitHub** updates starting from `3.1.0` to `3.1.2`, in case there were any changes to the **config**, **locales**, or **database**.

#### You do NOT need to download the script again for every version.

You only need to download the script **once** when performing the update, because the download already contains the **latest version**.

Through the **Update Link**, you will also find all available update versions on the left side.

**Example:**

```
updates/
├── 3.0.9.md
├── 3.1.0.md
├── 3.1.1.md
├── 3.1.2.md

.gitignore
README.md
```

You can find your current version in the **`fxmanifest.lua`** file inside the script.

The console will also tell you when you are running an outdated version and how many versions behind you are.

{% hint style="danger" %}
DO NOT UPDATE WHILE SERVER IS ONLINE! ALL SCRIPT UPDATES MUST HAPPEN WHILE SERVER IS OFFLINE!
{% endhint %}
