Jump to content

[Help] Using downloaded files in game


pro-mos

Recommended Posts

My script downloads files on the player's pc as he play

script/cache/water.fx
script/cache/wrap.txd

So when i try to use these files client side with

-- egineLoadtxd
-- and/or
dxCreateShader('cache/water.fx')

It doesn't work, with a warning like file not found.
Do i have to include downloaded files to the meta.xml?

Link to comment
11 minutes ago, MIKI785 said:

Obviously you have to finish downloading them before you run the dx functions. How do you actually download them?

the server sends the file data and i write them client side with

fileCreate('cache/'..filename)

after creating and writing the file, i try to load it right away.

Link to comment

i use triggerClientEvent to send the files, and i write them with fileWrite, and then close the files with fileClose, the files are fine, i can see them downloaded in deathmatch/resources/script/cache/water.fx

i think it might be a file path error, since im getting confused of how MTA's file path works

EDIT: i've found the problem was the files download with a script and i try to use them with another script.. i've added ':scriptname' to the file path and now it works, sorry for your time.

Edited by pro-mos
Link to comment
4 hours ago, MIKI785 said:

Ok then. But just a bit of advice, dont use triggerClientEvent to transfer large amount of data as it could stall the server. Use triggerLatentClientEvent instead.

i tried this latent event now, and it seems a lot slower than the normal triggerClientEvent, i've tested it on local server

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