Jump to content
qnw

How to synchronize'moddata'of'inventoryitem'

Recommended Posts

The'moddata'in'inventoryitem' cannot be synchronized to other clients when the client is modified. Now I can only synchronize data through'additemonserver'by recreating an identical item. But this brings many problems, especially the compatibility with other mods.

 

It may be possible to synchronize the ID of'inventoryitem'with the command between the client and the server, but I can't find a way to get'inventoryitem' through the ID on the client.

 

Does anyone know how to solve it? Or new ideas

Share this post


Link to post
Share on other sites

Data that needs to be synchronized to other clients should be transmitted from source client > server > the rest of clients.

 

Therefore, you should do it through 'OnServerCommand' and 'OnClientCommand' events.

1. Source player do 'sendClientCommand' containing the mod id, command and mod data

2. Server receive client command through 'OnClientCommand', process the transmitted data and send the mod data to all players except the source player through 'sendServerCommand'.

3. Other players receive the server command and synchronize according to the received mod data.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...