You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**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
2
25
3
26
There are **2 things** you need to worry about.
4
27
5
-
## 1. Adding new models (DFF/TXD/COL)
28
+
###1. Adding new models (DFF/TXD/COL)
6
29
7
30
The main concept of this system is that you can add new arbitrary numerical IDs that represent new models.
8
31
@@ -19,7 +42,7 @@ A game model can be added with up to **3 different files** for a certain entity
19
42
20
43
The files must be placed in the [models](/newmodels_azul/models/) folder. The system will automatically load them.
21
44
22
-
### File & Folder Structure
45
+
####File & Folder Structure
23
46
24
47
-**Possibility #1** (the new models do not have names): `models/<model_type>/<base_model_id>/<new_model_id>.<file_extension>`
25
48
@@ -31,34 +54,33 @@ e.g. `models/ped/7/-3.dff`
31
54
e.g. `models/ped/7/Mafioso 1/-2.txd`
32
55
e.g. `models/ped/7/Mafioso 1/-2.dff`
33
56
34
-
### NandoCrypt Support (Optional)
57
+
####NandoCrypt Support (Optional)
35
58
36
59
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).
37
60
38
61
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.
39
62
40
-
### Additional customization
63
+
####Additional customization
41
64
42
65
Models can be customized with `<new_model_id>.txt` files. Check [this README](/newmodels_azul/models/README.md) for more information.
43
66
44
-
## 2. Using the new models
67
+
###2. Using the new models
45
68
46
69
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.
47
70
48
71
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**.
49
72
50
73
See the [example resources](/[examples]/) to understand how to use the following methods.
51
74
52
-
### Server VS Client
75
+
####Server VS Client
53
76
54
77
All newmodels exported functions are shared, meaning you can use them in both client and server side scripts. Their behaviors are different.
55
78
56
79
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.
57
80
58
81
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.
59
82
60
-
61
-
### Importing functions
83
+
#### Importing functions
62
84
63
85
The easiest way is to use the following method in the beginning of your script to load the necessary functions.
64
86
@@ -77,7 +99,7 @@ Example usage:
77
99
localvehicle=createVehicle(id, x, y, z, rx, ry, rz, numberplate)
78
100
```
79
101
80
-
### Calling exported functions
102
+
####Calling exported functions
81
103
82
104
If you do not wish to use `loadstring` to import the functions, you can call them directly.
83
105
@@ -91,7 +113,7 @@ Example usage:
91
113
localvehicle=exports['newmodels_azul']:createVehicle(id, x, y, z, rx, ry, rz, numberplate)
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/)).
0 commit comments