![]() |
Force Download
I want a function to force a download of a file on the player.
When players edit an image file, it can screw up a lot of things... An example, if on player worlds that use staff blocks (but don't set the shape to block), all you have to do is delete the file, or edit it, and like magic...its gone. There should be a way to force a file download, so the image is re-downloaded, and no problems occur. If this could be added in an update, or even the next version, It would be very much appreciated. (Or even anything similar to this) |
It shouldn't be terribly hard to implement something that checksums the file on the server, and compares it to the checksum on the client each time the file gets buffered into memory.
But, you should really just setshape on something that important. |
I use an array of common images, and isimgpixeltransparent to catch people who modify them :)
|
You shouldn't be using staff blocks for anything important, it's way too easy to "hack" over them.
|
The staff block was just an example. XD
I was just requesting this feature, and couldnt think of another example on the spot. -.- |
Sorry for double post, but I found this while searching for scripts.
HTML Code:
fileupdate(str) - returns boolean - requests the download or reloading of a fileI tried just the image file, with the folder path, relative to levels folder, etc. But I just can't get it to work... Any help? |
fileupdate is kind of useless nowadays, it was more so back when you did File I/O via Scripts and the files didn't appear in the File Browser until you did /refreshfilelist.
I don't think there's a command to actually force a re-download on the client-side. You can do this though on the server-side to have everyone re-download it. PHP Code:
|
The way I imagine it's best to do is to have a list of file sizes of common images, and if they're off from the server's file size, disconnect the player. Use a "base" type update package to download the images on login.
Just a theory, though :p. Quote:
|
Quote:
|
Quote:
I agree, a setshape is the best way to make sure objects block regardless of the image; I was just trying to answer the question of the best way to force download an image :). |
I meant easy for Stefan, not for a GS2 developer.
As far as I know, there is no hook for when something gets buffered into memory, so that'd actually be impossible. The file rewriting thing is cool, although, the reason it works is probably because it changes the "file changed time", so I wonder if there is a better way than actually rewriting the whole thing (which could cause big problems if the file is large). |
Quote:
PHP Code:
|
You can configure gupd files to use checksum check instead of file modification time comparison. It's better to not use it for a lot of files because checksum check means it needs to read the whole file.
|
| All times are GMT +2. The time now is 10:57 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.