Jump to content

FernandoMTA

Recommended Posts

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

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!

  • Thanks 1
Link to comment
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!

spacer.png

 

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

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 by The_GTA
  • Like 1
Link to comment
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
3 hours ago, The_GTA said:

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 by FernandoMTA
Link to comment
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
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

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 by The_GTA
  • Thanks 1
Link to comment
  • 2 weeks later...

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 by SpoonTheMan
  • Like 2
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...