Efficient Attachment Sync 1.0.4

   (11 reviews)

2 Screenshots

About This File

Most of the server developers (ones that don't patiently wait for *something large*, though this resource is powerful enough) use their own server-side object attachments implementation that represents some large JSON with all the object and attachment information. This resource lets you cache "static attachments" in the client-side code so thanks to efficient utilization of the shared data it just uses a small shared variable to do the attachment processing without any need to create server-side objects nor send its data.

 

For example, if you want to attach a specific object to specific ped bone with spefic bone offset and object rotation, this will only use a ~4-8 byte shared variable keeping it accurate. User-made implementations I have seen before usually take ~100 bytes per an object.

 

API: Client-side

  • mp.attachmentMngr.register(attachmentId, model, bone, offset, rotation)
  • mp.attachmentMngr.addLocal(attachmentId) (synced!)
  • mp.attachmentMngr.removeLocal(attachmentId) (synced!)

 

API: Server-side

  • player.addAttachment(attachmentId, remove)
  • player.hasAttachment(attachmentId)

 

Example Resource

There's an example resource in /client-packages/epic-attachments folder. It lets you toggle attachments (there are like 30 attachments) using a NativeUI-based menu. Thanks to root for his contributions made to the example resource.

 

 

 


What's New in Version 1.0.4   See changelog

Released

Bug fix

  • Like 5



User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest

Original

· Edited by Original

   2 of 2 members found this review helpful 2 / 2 members

C# when to make it more ok? 

Share this review


Link to review
rootcause

   2 of 4 members found this review helpful 2 / 4 members

it's ok

Share this review


Link to review
Jaimuzu

   1 of 2 members found this review helpful 1 / 2 members

it's epic

Share this review


Link to review
Sethan

   0 of 1 member found this review helpful 0 / 1 member

Great resource, thanks

Share this review


Link to review
Jengas

   0 of 1 member found this review helpful 0 / 1 member

Best!

Share this review


Link to review
Morbo

   0 of 1 member found this review helpful 0 / 1 member

Thx

Share this review


Link to review
hubba

   0 of 1 member found this review helpful 0 / 1 member

it's ok

Share this review


Link to review
kemperrr

   0 of 1 member found this review helpful 0 / 1 member

It's ok

Share this review


Link to review
Dimitri Stupakis

  

Great Work, I like it.

How can I add additional objects?
I tried  to register some stuff like the coffee cup or a beer but it always say: Unknown Attachment Used???

mp.attachmentMngr.register("drinkbeer", "prop_beer_bottle", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0));

c.TriggerEvent("addAttachment", 1172836182);

 

mp.events.add("addAttachment", (hash) => {
    mp.attachmentMngr.addLocal(hash);
});

It works with the existing stuff but I can't add a new object, please help! Thanks!

Share this review


Link to review
n0minal

· Edited by n0minal

  

Awesome resource, I'll use it on my server.

Share this review


Link to review