Jump to content

triggerLatentClientEvent - Question


Recommended Posts

Hey,

I have used triggerLatentClientEvent and some other functions to make a custom downloader, everything works fine. But now I want to know how I can query the total bytes that has already been transferred since it has started. I hope you can help me.

(Showing any code is unnecessary, if such answers occur)

Best Regards

Link to comment

You cant use GetLatentEventStatus from client to check status of triggerLatentClientEvent.

There are two solutions I can think of at the moment:

1. Use a timer to send percent complete for the latent event from server to client, and interpolate between the values each time to make it smoother.

2. Dont use a timer and instead use triggerClientEvent right after triggerLatentClientEvent to send the size of the data that is being sent (by using getLatentEventStatus), and then save getNetworkStats().bytesReceived in the client event to a variable and compare the bytes received from download start to current amount of bytes received (getNetworkStats().bytesReceived - bytesReceivedAtStart) in onClientRender to display it or something.

Link to comment
  • 3 months later...
  • MTA Team

That function only works on the scriptside, where the latent event has been started. That means you trigger a latent client event on serverside then you can use that handler only serverside, because it's not shared.

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...