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
Copy file name to clipboardExpand all lines: .github/doc/DOCUMENTATION.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,15 @@ Remember, the model allocation happens only clientside, so the server has no con
49
49
50
50
See the [example resources](/[examples]/) to understand how to use the following methods.
51
51
52
+
### Server VS Client
53
+
54
+
All newmodels exported functions are shared, meaning you can use them in both client and server side scripts. Their behaviors are different.
55
+
56
+
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
+
58
+
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
+
60
+
52
61
### Importing functions
53
62
54
63
The easiest way is to use the following method in the beginning of your script to load the necessary functions.
@@ -77,6 +86,18 @@ Check the [`meta.xml`](/newmodels_azul/meta.xml) file to see the exported functi
77
86
Example usage:
78
87
79
88
```lua
80
-
-- The normal createVehicle would not work invented IDs such as -2
89
+
-- The normal createVehicle would not work with invented IDs such as -2,
90
+
-- so we call the available exported function
81
91
localvehicle=exports['newmodels_azul']:createVehicle(id, x, y, z, rx, ry, rz, numberplate)
82
92
```
93
+
94
+
## Important Tips ⚠️
95
+
96
+
These are good practices and general advice.
97
+
98
+
- Remember that your models must work well with GTA: San Andreas in terms of optimization.
99
+
- Always test with several players and different PC specifications.
100
+
- An element created serverside with a custom model will sync its custom model to all clients.
101
+
- Useful for spawning vehicles, setting player and NPC skins.
102
+
- An element created clientside with a custom model will not sync to other clients, meaning only the client that ran the code will see the custom model.
103
+
- Useful for model previewing and object spawning which works best clientside.
0 commit comments