Skip to content

Commit f5091ef

Browse files
Add FAQ and SAMP models info
1 parent f09f385 commit f5091ef

File tree

4 files changed

+56
-11
lines changed

4 files changed

+56
-11
lines changed

.github/doc/DOCUMENTATION.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1-
# Quick Start
1+
# `Newmodels Azul` Documentation
2+
3+
## Frequently Asked Questions (FAQ)
4+
5+
⚠️ Do not forget to check the [Basics](#basics) section below.
6+
7+
| **Question** | **Answer** |
8+
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
9+
| **What do I need to know to use this system?** | Basic knowledge of MTA scripting (Lua) and how MTA servers and game clients work. |
10+
| **Who is this system intended for?** | Server owners and developers who want to add new models to their MTA server for custom skins, vehicles, objects, etc. |
11+
| **Will players download the files (DFF/TXD/COL) of the added models automatically?** | Yes, the [`meta.xml`](/newmodels_azul/meta.xml) configuration includes all of these files in the [models folder](/newmodels_azul/models/) so they are automatically downloaded by players when they join the server. |
12+
| **Why not use the `download="false"` attribute in the `meta.xml` so they are not downloaded by players, then download them on demand?** | This feature is currently not implemented due to common complaints about `downloadFile` sometimes being unreliable and causing server lag. It is better to serve all files to the player at once. |
13+
| **Can I encrypt my model files and hide the decryption key so players cannot steal them?** | Yes, you can use the **NandoCrypt** which is natively supported by this system. |
14+
| **How are added models identified?** | New models are identified by numerical IDs that you define. These IDs can be any number (positive or negative) as long as they do not conflict with existing or reserved game IDs. They are purely arbitrary and do not have to be sequential. |
15+
| **Why new model IDs and not strings/names for identification?** | MTA uses numerical IDs to identify models, so this system follows the same convention. It is more efficient and easier to work with numbers than strings. |
16+
| **How do I add models using this system?** | Essentially, you add new models by placing the DFF/TXD/COL files in the [models folder](/newmodels_azul/models/) with specific file and folder names. |
17+
| **How do I use the new models in my scripts?** | You can use the exported functions provided by this system in your own scripts. |
18+
| **Can I use the new models in my existing scripts without modifying them?** | In theory, yes. You can use the `loadstring` method to import the functions at the beginning of your script. This will modify the MTA functions to work with the new IDs. However, always be careful and verify if you do not break any feature in your scripts. |
19+
| **Can I use the new models in my existing scripts by calling the exported functions directly?** | Yes, you can call the exported functions directly in your scripts, without using `loadstring`. |
20+
| **Can I use the new models in both server-side and client-side scripts?** | Yes, the exported functions are shared, meaning you can use them in both client and server side scripts. However, their behaviors are different. |
21+
| **Why is are new models added client-side in MTA and this logic doesn't exist server-side?** | MTA model allocation happens client-side, so the server has no concept of any new IDs. Server-side model allocation is still not implemented on MTA (but may be in the future 😉), so this system provides a way to work around this limitation. |
22+
| **Are there any premade modpacks for new models that I can drag & drop to my server?** | Sure, the community has created many new object, vehicle and skin mods over the years. You can search for these models online. [You can find more information here about adding all of SA-MP's objects.](/newmodels_azul/models/object/1337/SAMP/README.md) |
23+
24+
## Basics
225

326
There are **2 things** you need to worry about.
427

5-
## 1. Adding new models (DFF/TXD/COL)
28+
### 1. Adding new models (DFF/TXD/COL)
629

730
The main concept of this system is that you can add new arbitrary numerical IDs that represent new models.
831

@@ -19,7 +42,7 @@ A game model can be added with up to **3 different files** for a certain entity
1942

2043
The files must be placed in the [models](/newmodels_azul/models/) folder. The system will automatically load them.
2144

22-
### File & Folder Structure
45+
#### File & Folder Structure
2346

2447
- **Possibility #1** (the new models do not have names): `models/<model_type>/<base_model_id>/<new_model_id>.<file_extension>`
2548

@@ -31,34 +54,33 @@ e.g. `models/ped/7/-3.dff`
3154
e.g. `models/ped/7/Mafioso 1/-2.txd`
3255
e.g. `models/ped/7/Mafioso 1/-2.dff`
3356

34-
### NandoCrypt Support (Optional)
57+
#### NandoCrypt Support (Optional)
3558

3659
You may use [NandoCrypt](https://github.com/Fernando-A-Rocha/mta-nandocrypt) to encrypt your mod files. Place them with file extension `.nandocrypt` so they are automatically recognised. You may customize the file extension in [`shared_local.lua`](/newmodels_azul/scripts/core/shared_local.lua).
3760

3861
A test `nando_decrypter` script is included with the resource, as well as a mod consisting of 2 encrypted files (`-5.dff.nandocrypt` and `-5.txd.nandocrypt`). To use your own mods, you will have to replace `nando_decrypter` with your own decrypter script generated by the NandoCrypt tool.
3962

40-
### Additional customization
63+
#### Additional customization
4164

4265
Models can be customized with `<new_model_id>.txt` files. Check [this README](/newmodels_azul/models/README.md) for more information.
4366

44-
## 2. Using the new models
67+
### 2. Using the new models
4568

4669
MTA allocates unused IDs **clientside** to load the new models (thanks to [`engineRequestModel`](https://wiki.multitheftauto.com/engineRequestModel)). These IDs are unpredictable and you can not depend on them.
4770

4871
Remember, the model allocation happens only clientside, so the server has no concept of any new IDs. As a developer, you have 2 options to be able to **use the new IDs you defined in your scripts**.
4972

5073
See the [example resources](/[examples]/) to understand how to use the following methods.
5174

52-
### Server VS Client
75+
#### Server VS Client
5376

5477
All newmodels exported functions are shared, meaning you can use them in both client and server side scripts. Their behaviors are different.
5578

5679
The **server-side** functions, specifically for setting a custom model (or creating an element with a custom model) will save the custom models of elements present in your server in a `table`, then sync them using `triggerClientEvent` to all clients online. This means that, for example, creating a vehicle that is a new Helicopter, will automatically make it that model for all players in your server.
5780

5881
In contrast, **client-side** functions do not perform any synchronization of data with other clients. Custom models set by client-side scripts are only applied to the client that is running those scripts. This means that, for example, in a clothing store scenario you can change the player's model to any custom models using client-side functions, and only that player will see the model change in their game.
5982

60-
61-
### Importing functions
83+
#### Importing functions
6284

6385
The easiest way is to use the following method in the beginning of your script to load the necessary functions.
6486

@@ -77,7 +99,7 @@ Example usage:
7799
local vehicle = createVehicle(id, x, y, z, rx, ry, rz, numberplate)
78100
```
79101

80-
### Calling exported functions
102+
#### Calling exported functions
81103

82104
If you do not wish to use `loadstring` to import the functions, you can call them directly.
83105

@@ -91,7 +113,7 @@ Example usage:
91113
local vehicle = exports['newmodels_azul']:createVehicle(id, x, y, z, rx, ry, rz, numberplate)
92114
```
93115

94-
## Important Tips ⚠️
116+
### Important Tips ⚠️
95117

96118
These are good practices and general advice.
97119

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.txd
2+
*.dff
3+
*.col
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# `newmodels_azul`: SA-MP Object Models
2+
3+
With [`newmodels_azul`](https://github.com/Fernando-A-Rocha/mta-add-models) you can add all of [SA-MP's object models](https://dev.prineside.com/en/gtasa_samp_model_id/tag/2-sa-mp/) to your server, so you can use them to create custom maps, or spawn objects using Lua scripts.
4+
5+
## Attention ⚠️
6+
7+
There are over 1,400 SA-MP object models! It is not recommended to add all of them to your server unless you will really need them, as it will increase the download size for players.
8+
9+
Instead, you can add only the models you need.
10+
11+
## How to install
12+
13+
1. [Download](https://www.mediafire.com/file/mgqrk0rq7jrgsuc/models.zip/file) `models.zip` containing all dff/txd/col files required (total of 4,297 files; 404 MB when extracted)
14+
2. Extract the contents of the zip to [newmodels_azul/models/object/1337/SAMP](/newmodels_azul/models/object/1337/SAMP/).
15+
16+
You're done! Newmodels will load the new models automatically when you start the resource. Their IDs are exactly the same as the IDs used in SA-MP.
17+
18+
You may test spawning a SA-MP object using the test command `/testobj <id>` e.g. `/testobj 11686` ([this is a bar counter](https://dev.prineside.com/en/gtasa_samp_model_id/model/11686-CBarSection1/)).
19+
20+
![Example](./sampobj.png)
1.56 MB
Loading

0 commit comments

Comments
 (0)