John Smith Posted September 18, 2015 Posted September 18, 2015 Hello. I'm facing a problem. I can't find a way how to know when resource has finished downloading (down)loading files. I thought onResourceStart would be triggered after the resource files were (down)loaded, but onResourceStart seems to trigger when the download starts. I'm asking for help in here because i'm facing an error which says something similiar to unable to load dff/txd file before onClientFileDownloadComplete event has finished (when that error happens, resource files are still downloading) Is there a solution to this or should i create a custom downloader for scripts/files? If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
t3wz Posted September 18, 2015 Posted September 18, 2015 onClientResourceStart This event is triggered when a resource is started. Please note that this is not triggered the same time as the serverside event onResourceStart is. The event is triggered when any clientside resources are started. This means it is triggered when a clientside script is initiated after a download, which includes downloading after join.
Moderators IIYAMA Posted September 19, 2015 Moderators Posted September 19, 2015 John, but onResourceStart seems to trigger when the download starts. This is incorrect. A resource can't start when not all files are there. If that was true, each resource would give a lot of errors while starting. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ixjf Posted September 19, 2015 Posted September 19, 2015 How so? The event is triggered when the resource is started on the server - after server side scripts are loaded. The onClientResourceStart event is very similar, except it is triggered after all the client files are downloaded (which implies the resource is already running on the server). I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
JR10 Posted September 19, 2015 Posted September 19, 2015 The server-side code is executed as soon as the resource is started, the client-side is executed when the files are downloaded. So, yes, onResourceStart can be called while the client is still downloading. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Moderators IIYAMA Posted September 19, 2015 Moderators Posted September 19, 2015 Ah indeed, I did misread. I thought he mentioned onClientResourceStart. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now