Popular Post FernandoMTA Posted November 17, 2021 Popular Post Share Posted November 17, 2021 (edited) mta-add-models is a library/framework resource that I made: Its purpose is allowing you to add new peds(skins)/objects/vehicles to your server. All the new added models will be automatically synced with all players. Supports encrypted mod files using the NandoCrypt system. As of v2.0.0, files with attribute download="false" in meta.xml are supported, and newmodels will handle downloading them! The way to achieve this is by following the tutorial included in the project's documentation (see GitHub link below) The resource comes with test commands for you to experiment with the mods provided and see what's going on under the hood. You're meant to make your own implementations to use newmodels in your server's complex systems. GitHub Repo (Download): https://github.com/Fernando-A-Rocha/mta-add-models#readme (Documentation here) (NEW) Custom Map Editor Community Page (Alternative Download): https://community.multitheftauto.com/index.php?p=resources&s=details&id=18598 For support/questions please access my main thread: https://forum.multitheftauto.com/topic/139644-rel-nandos-resources/ I hope you enjoy! Edited July 6 by FernandoMTA 14 Link to comment
FernandoMTA Posted November 17, 2021 Author Share Posted November 17, 2021 Released version 1.1 (https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.1) : added support for objects Todo: support adding new vehicles 1 Link to comment
Mohab Posted November 17, 2021 Share Posted November 17, 2021 Seems like a good idea, well done.. I will try it later good luck 1 Link to comment
murilo2929 Posted November 17, 2021 Share Posted November 17, 2021 I'm using on my server abd it'd working all good. ass. Estrela 1 Link to comment
Popular Post The_GTA Posted November 17, 2021 Popular Post Share Posted November 17, 2021 (edited) I like the idea of your resource! It acts as a scripting backend, hence the suffix "(library)", which allocates new real model IDs for your own virtual set of model IDs. There appears to be a requirement to a fixed set of models into the resource so that it can sync them to players. Found issues in version 1.1.0 if there are two peds synced for the player and both have the same custom model assigned to them, then if one of them streams out your syncer attempts to release the custom model for both of the ped elements, especially the one already streamed in. While the documentation of engineFreeModel does not mention what happens in this case, I assume that the request fails. This scenario is a potential model ID leak (the client will run out of available real model IDs at some point). Even worse: the client could run out of RAM very quickly. Here are my suggestions add a custom model cache based on usage frequency, API hinting (setCustomModelAlwaysLoaded) or database flag so that MTA does not have to perform the expensive disk loading of model data as frequently (improves FPS) add a way to register custom models from other storage resources. This way custom models could potentially be downloaded from the server on-demand by a second resource and - after finishing the download - be registered as custom model inside of your own resource. Could be really fun! add statistics API about the number of custom models loaded, their usage details (frequency, number of elements with the model, etc) and the general performance of the resource. You could even add a debug dashboard using some hidden key combination (very important to build user-trust into your resource workings) One issue and suggestions · Issue #1 · Fernando-A-Rocha/mta-add-models (github.com) Nice work so far! Keep it up. Edited November 17, 2021 by The_GTA 4 Link to comment
FernandoMTA Posted November 17, 2021 Author Share Posted November 17, 2021 5 hours ago, The_GTA said: I like the idea of your resource! It acts as a scripting backend, hence the suffix "(library)", which allocates new real model IDs for your own virtual set of model IDs. There appears to be a requirement to a fixed set of models into the resource so that it can sync them to players. Found issues in version 1.1.0 if there are two peds synced for the player and both have the same custom model assigned to them, then if one of them streams out your syncer attempts to release the custom model for both of the ped elements, especially the one already streamed in. While the documentation of engineFreeModel does not mention what happens in this case, I assume that the request fails. This scenario is a potential model ID leak (the client will run out of available real model IDs at some point). Even worse: the client could run out of RAM very quickly. Here are my suggestions add a custom model cache based on usage frequency, API hinting (setCustomModelAlwaysLoaded) or database flag so that MTA does not have to perform the expensive disk loading of model data as frequently (improves FPS) add a way to register custom models from other storage resources. This way custom models could potentially be downloaded from the server on-demand by a second resource and - after finishing the download - be registered as custom model inside of your own resource. Could be really fun! add statistics API about the number of custom models loaded, their usage details (frequency, number of elements with the model, etc) and the general performance of the resource. You could even add a debug dashboard using some hidden key combination (very important to build user-trust into your resource workings) Nice work so far! Keep it up. Thank you very much for your feedback!! Also good reflex of opening an issue on the GitHub repo, I'll reply there and tackle the issue. Will post change log here of course Link to comment
DiSaMe Posted November 17, 2021 Share Posted November 17, 2021 Wow... When I saw that MTA allows creating new model IDs but it was only client-side, I though, "oh, that's nice, we're close to it, but it's not time for it yet". It never occurred to me that we can just create elements with built-in models and then call setElementModel on the client. Great job! 1 Link to comment
FernandoMTA Posted November 17, 2021 Author Share Posted November 17, 2021 1 hour ago, Reyomin said: Wow... When I saw that MTA allows creating new model IDs but it was only client-side, I though, "oh, that's nice, we're close to it, but it's not time for it yet". It never occurred to me that we can just create elements with built-in models and then call setElementModel on the client. Great job! On a serious note, yeah, this feature really opens up a lot of possibilities! I can't wait to see what people come up with. Link to comment
The_GTA Posted November 17, 2021 Share Posted November 17, 2021 (edited) I really like that you have quickly added a lot of debug feedback to your script! I am looking at things such as the drawAllocatedTable function and I am impressed with the progress of your resource. Some suggestions · Issue #3 · Fernando-A-Rocha/mta-add-models (github.com) Not checking the element-data key during onClientElementDataChange · Issue #2 · Fernando-A-Rocha/mta-add-models (github.com) Element models not released by destroyElement (issue?) · Issue #4 · Fernando-A-Rocha/mta-add-models (github.com) Edited November 17, 2021 by The_GTA 1 Link to comment
httpRick Posted November 17, 2021 Share Posted November 17, 2021 Please add when ElementData is removed then let it restore the original model Test Code Server Side: for i=1,20 do local ped = createPed(0, 0+i, 0, 5) setTimer(function() if ped then local data_name = exports.newmodels:getDataNameFromType("ped") if hasElementData(ped, data_name) then removeElementData(ped, data_name) else local skin = math.random(20001, 20003) setElementData(ped, data_name, skin) end end end, 500, 0) end Please add when ElementData is removed then let it restore the original model Link to comment
FernandoMTA Posted November 17, 2021 Author Share Posted November 17, 2021 (edited) 3 hours ago, The_GTA said: I really like that you have quickly added a lot of debug feedback to your script! I am looking at things such as the drawAllocatedTable function and I am impressed with the progress of your resource. Some suggestions · Issue #3 · Fernando-A-Rocha/mta-add-models (github.com) Not checking the element-data key during onClientElementDataChange · Issue #2 · Fernando-A-Rocha/mta-add-models (github.com) Element models not released by destroyElement (issue?) · Issue #4 · Fernando-A-Rocha/mta-add-models (github.com) Thank you! I've implemented one of the suggestions you put in Issue #3, and the other Issues #2 and #4 have been fixed. 1 hour ago, httpRick said: Please add when ElementData is removed then let it restore the original model Test Code Server Side: for i=1,20 do local ped = createPed(0, 0+i, 0, 5) setTimer(function() if ped then local data_name = exports.newmodels:getDataNameFromType("ped") if hasElementData(ped, data_name) then removeElementData(ped, data_name) else local skin = math.random(20001, 20003) setElementData(ped, data_name, skin) end end end, 500, 0) end Please add when ElementData is removed then let it restore the original mode Done, added a test command "/t3" for you to test exactly that, try the latest source code Edited November 17, 2021 by FernandoMTA Link to comment
FernandoMTA Posted November 17, 2021 Author Share Posted November 17, 2021 Lots of major updates & changes today, haven't created a release yet, things are still being tested! Meanwhile, here's a feedback page on the GitHub repo: https://github.com/Fernando-A-Rocha/mta-add-models/issues/7 Link to comment
FernandoMTA Posted November 19, 2021 Author Share Posted November 19, 2021 New update: https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.3.0 You can now add vehicles Give it a try! PS. If you have Lua scripting / MTA c++ knowledge please check out Issue #8 on the repo, I'm unable to identify the cause of the behavior. Thank you! Link to comment
FernandoMTA Posted November 19, 2021 Author Share Posted November 19, 2021 7 hours ago, FernandoMTA said: If you have Lua scripting / MTA c++ knowledge please check out Issue #8 on the repo, I'm unable to identify the cause of the behavior. Thank you! Issue is still open: https://github.com/Fernando-A-Rocha/mta-add-models/issues/8 but a solution has been put in place, which means: New update https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.4.0 Full support for adding ped, object and vehicle mods through other resources using the library. Enjoy and let me know how it goes! Link to comment
FernandoMTA Posted November 20, 2021 Author Share Posted November 20, 2021 Another update https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.5.0 - Placed all configuration variables in a single _config.lua file for simplicity! - Added sampobj_reloaded resource that adds all SA-MP objects to your server on startup! Read the updated documentation to find out how to use it Link to comment
Fanbox Posted November 20, 2021 Share Posted November 20, 2021 (edited) Well Done!!! Edited November 20, 2021 by Fanbox 1 Link to comment
mono1 Posted November 20, 2021 Share Posted November 20, 2021 This is really amazing! Is there an example resource for added vehicles parked in one spot? Link to comment
FernandoMTA Posted November 20, 2021 Author Share Posted November 20, 2021 15 hours ago, mono1 said: This is really amazing! Is there an example resource for added vehicles parked in one spot? I will make one, keep an eye on the github repo Link to comment
FernandoMTA Posted November 20, 2021 Author Share Posted November 20, 2021 15 hours ago, mono1 said: This is really amazing! Is there an example resource for added vehicles parked in one spot? Here you go, small new release: https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.5.1 The command you're looking for is /testvehicles Start 'newmodels-example' to use it 1 Link to comment
FernandoMTA Posted November 21, 2021 Author Share Posted November 21, 2021 Hotfix release: https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.6.0 sorry for spamming this thread, couldn't edit the previous message 1 Link to comment
mono1 Posted November 21, 2021 Share Posted November 21, 2021 5 hours ago, FernandoMTA said: Here you go, small new release: https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.5.1 The command you're looking for is /testvehicles Start 'newmodels-example' to use it Thank you that works perfectly! Is it also possible to create added objects/vehicles/peds via a .map file like with scene2res? Link to comment
FernandoMTA Posted November 22, 2021 Author Share Posted November 22, 2021 On 20/11/2021 at 22:43, mono1 said: Thank you that works perfectly! Is it also possible to create added objects/vehicles/peds via a .map file like with scene2res? It would be possible, of course. I just don't see in which situation you would actually need to load & create new objects/vehicles/peds from a .map file or any sort of file I'd have to make a script to parse & read. I think the time that it would take you to get that .map file you could rather spend making a script to achieve the same thing with the already existing tools my script gives you xD. But correct me if I'm wrong, I simply don't see how such thing would be used in a server! Link to comment
FernandoMTA Posted November 22, 2021 Author Share Posted November 22, 2021 Hotfix https://github.com/Fernando-A-Rocha/mta-add-models/releases/tag/v1.6.6 Link to comment
The_GTA Posted November 22, 2021 Share Posted November 22, 2021 (edited) Looks really great so far! I definitely recommend your resource to advanced modders if they want to get new models into the game. It has also become a good point for extensions using other resources that would depend on it. Once again I want to say: nice work! Edited December 3, 2021 by The_GTA 1 Link to comment
SpoonTheMan Posted December 3, 2021 Share Posted December 3, 2021 (edited) Dang, it's been a long time since I've been active on MTA but with all the amazing breakthroughs that have been happening these last few years I'm starting to think I just might come back soon! I have 3 questions regarding your tool. 1: does it support weapons? 2: can vehicle handling (and possibly weapon stats/effects) be applied independently to added models without changing the handling/stats of the existing content? 3: can added models be added into the F1 menu to be made easy to spawn like the existing content or do you have to enter commands to access added content as a player? Edited December 3, 2021 by SpoonTheMan 2 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now