Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .github/img/ss1.png
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Lint mta resources
run: |
echo 'ignore = {"512", "122","142","111","341","112","113","143","321","631","211","212","213","611","612","621"}' > config.lua
luacheck --config config.lua ./
luacheck --exclude-files '**/*async.lua' --config config.lua ./
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
# `Newmodels v5 Azul 💙`
# `Newmodels v6 Red 🍒`

This MTA resource makes use of the clientside allocated models ([engineRequestModel](https://wiki.multitheftauto.com/wiki/EngineRequestModel) and related features) to add new peds (skins), vehicles and objects:

- place your mods (dff/txd/col files) in designated folders that are automatically detected
- there are 3 methods to add new models:
- [1] place mod files (dff/txd/col files) in designated folders that are automatically scanned
- [2] place mod files anywhere you want and list them in the mod list lua script
- [3] dynamically load new models from external resources using exported functions
- the system syncs all added models with all players
- use a simple trick in your existing scripts to work with the new model IDs
- use a simple trick in your existing scripts to work with the new model IDs, or use the provided exported functions
- it's minimalistic, optimized and robust

With this resource you can make scripts or change your existing scripts to add new skin, vehicle and object IDs to your server! For example, you may add all SA-MP object models!
With this resource you can make scripts or change your existing scripts to add new skin, vehicle and object models to your server! For example, you may add all SA-MP object models!

## Docs/Tutorial

🚀 **Are you new to this resource?** Start here: [Documentation file](/.github/doc/DOCUMENTATION.md)
🚀 **Are you new to this resource?**

Start here: [DOCUMENTATION.md file](/newmodels_red/DOCUMENTATION.md)

## Download

⚠️ **Before you download and install this resource**, ensure you meet the requirements specified in the [Documentation](/.github/doc/DOCUMENTATION.md).
⚠️ **Before you download and install this resource**, ensure you meet the requirements specified in the **Documentation** linked above.

Get the [Latest Version](https://github.com/Fernando-A-Rocha/mta-add-models/releases/latest) from the **Releases** section.

## Older versions

It is easy to migrate to v5 from newmodels v4 (not from v3; the architecture of that version is no longer used). The **models folder structure remains the same**, but the scripts have changed in the way models are applied to elements.
## Migrating from Older versions

This resource no longer uses and relies on the **MTA Element Data system** (`setElementData`) to sync the models to all clients! Instead, newmodels makes use of Lua tables and MTA events. This major change was made to **improve performance** and control the sync of models more efficiently.
Please refer to the **Migration Guide** in the [MIGRATION.md file](/newmodels_red/MIGRATION.md).

## Community

Visit the [Thread on the MTA Forum](https://forum.mtasa.com/topic/133212-rel-add-new-models-library/) to get in touch with fellow users and developers.

## Media

![Screenshot 1](/.github/img/ss1.png)

## Final Note

Feel free to update the documentation in this repository, and contribute to the code via pull requests.
Expand Down
20 changes: 20 additions & 0 deletions [examples]/sampobj_red/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# `sampobj_red`: SA-MP Objects for Newmodels v6

With [`newmodels_red`](https://github.com/Fernando-A-Rocha/mta-add-models) (and `sampobj_red` resource) 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.

## Large Size ⚠️

There are over 1,400 SA-MP object models! It is recommended to keep `download="false"` in the resource's `meta.xml` as well as `metaDownloadFalse=true` in `server.lua` to prevent clients from downloading all the models when they join your server.

## How to install

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)
2. Extract the contents of the zip to [sampobj_red/models/]([examples]/sampobj_red/models/) folder.

You're done! Newmodels will load the new models automatically when you start the `sampobj_red` resource. Their IDs are exactly the same as the IDs used in SA-MP.

You may test spawning a SA-MP object using the newmodels test commands. E.g. `11686` ([is a bar counter](https://dev.prineside.com/en/gtasa_samp_model_id/model/11686-CBarSection1/)).

## Media

![Example](./sampobj.png)
20 changes: 20 additions & 0 deletions [examples]/sampobj_red/meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<meta>
<!-- This resource is available in the repository below.
Its version matches the main newmodels version!
https://github.com/Fernando-A-Rocha/mta-add-models -->

<info author="Fernando" name="SAMP Objects Red"
description="uses newmodels functions to add all SA-MP objects"
version="6.0.0"
type="script" />

<!-- IMPORTANT TO HAVE THIS VERSION OR HIGHER SO THAT IT WORKS AS EXPECTED
https://nightly.mtasa.com -->
<min_mta_version client="1.6.0-9.22649.0" server="1.6.0-9.22649.0"/>

<file src="models/*.col" download="false"/>
<file src="models/*.txd" download="false"/>
<file src="models/*.dff" download="false"/>

<script type="server" src="server.lua" />
</meta>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.txd
*.dff
*.txd
*.col
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Download link in README.md, extract all dff,txd,col files here
Binary file added [examples]/sampobj_red/sampobj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading