![]() |
GScript File Handling?
I'm currently trying to script a CRC check that works on images - basically gets the byte size of the original image and compares it to the player's image, if it's over or under, the file gets deleted and is replaced with the original, if it isn't then it goes on as normal.
I can do this fairly easily - one problem: I don't know of a command/variable that deals with files in gscript. Could someone point me towards a wiki article or the proper syntax/commands to do so? It'd be greatly appreciated. |
Quote:
PHP Code:
|
And I could do loadlines on an image file and it'd work fine? I'm doubting that alot - all I'm really after is some way of getting the byte size of the file as a variable I can manipulate a little.
Or would loadlines return the size of the file opened in bytes anyway? |
You can do loadstring() on the image and then return length().
I never managed to get loadstring() to work, though (but I never put more then a few minutes into trying). I personnally can hardly wait for the next client version so I can loadlines() an image clientside! :D |
I tried loadlines() on an image serverside, it returned 0 when sent back in a sendrpgmessage.
I also tried loadstring(), yielding the same result. I'm not quite sure what to do now. Could I get the byte size of the file through sockets somehow? EDIT: Not sure the npcserver has r/w access. |
You could use var.loadstring(filename) and then checksum(string) or md5(string). For getting the file size you could also simply use filesize(filename)
|
Yeah, sounds like the best idea. Just checksum() or md5() the file on both the client and the server and compare. This will reduce the packet size sent in your triggeraction.
Also: After reading your initial post again, I don't think you can do what you are trying to do just yet. You will be able to get the data on the serverside (add rights to the npcserver; that is probably your problem) but you won't be able to on the client. You gotta wait like everyone else for the new client version. :[ |
Okay, the checksum is nailed.
Now, is there any way to delete/force a client to delete/download a specific file? |
|
Weird, there is no reloadfile() command, not sure who has added that.
Normally if a file is updated on serverside then it is automatically sent to the players who have already seen the file. |
Quote:
|
| All times are GMT +2. The time now is 01:43 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.