karlis Posted April 25, 2010 Share Posted April 25, 2010 hi, i was wondering, is it possible to stream a file(not script, but image, sound etc), while script itself is running here is lame example, but its purpose is only to show the idea(yes i know theres no filewrite() clientside) --SERVER file=fileOpen("myimage.png") while not fileIsEOF(file) do triggerClientEvent(getRootElement(),"onsendfile",getRootElement(),fileread("myimage.png",500)) end --CLIENT file=fileCreate("myimgrecived.png") addEvent("onsendfile",true) addEventHandler("onsendfile",getRootElement(),function(buffer) fileWrite(file,buffer) end) Link to comment
50p Posted April 25, 2010 Share Posted April 25, 2010 If there is no fileWrite client-side then it's not possible. I think you didn't construct your question properly.. First, you say "i was wondering if it's possible" but then you say "i know there is no fileWrite clientside"... So basically, you answer your question in a question. Besides, you'd get error/warning if you'd want to open a file in client-side script, like guiCreateStaticImage with that streamed image because functions like guiCreateStaticImage, playSound, etc. need to know that file is available to use (). Try to place a .png image in client-side resource and try to open it with client-side script. You know the file exists but resource can't see it (no in meta.xml). Link to comment
DakiLLa Posted April 25, 2010 Share Posted April 25, 2010 I think this can help you a bit. Link to comment
karlis Posted April 25, 2010 Author Share Posted April 25, 2010 lol k, i know that i can specify them in meta, i was asking is it possible to send them while resource running, only on request, and for 1 player only and i know there is also some io.write function in lua, so i asked this well you ansvered, so ok thanks edit: dak, yes i saw this, but this is clearly for scripts only Link to comment
50p Posted April 25, 2010 Share Posted April 25, 2010 lol k, i know that i can specify them in meta, i was asking is it possible to send them while resource running, only on request, and for 1 player onlyand i know there is also some io.write function in lua, so i asked this well you ansvered, so ok thanks edit: dak, yes i saw this, but this is clearly for scripts only Most of Lua libraries are blocked by MTA, so is io. Link to comment
karlis Posted April 26, 2010 Author Share Posted April 26, 2010 https://forum.multitheftauto.com/viewtop ... es#p305140 so gamesnerts example is totally invalid Link to comment
Gamesnert Posted April 26, 2010 Share Posted April 26, 2010 so gamesnerts example is totally invalid ... function keepImageLoaded() dxDrawImage(0,0,0,0,"imagefile.ext") end addEventHandler("onClientRender",getRootElement(),keepImageLoaded) This is basically what it comes down to. You just draw *cough* the image with size 0x0. This means you can't see it, but the picture is still being loaded. I prefer having something like: image = fileOpen("lol.png") ... dxDrawImage(x, y, w, h, image) Link to comment
karlis Posted April 26, 2010 Author Share Posted April 26, 2010 sory, if you prefer something i get that you use that you preferred Link to comment
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