AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Search for files in *.gcf files (https://forums.alliedmods.net/showthread.php?t=93743)

Silencer123 06-01-2009 18:08

Search for files in *.gcf files
 
file_exists(file[]) searches for files in the mod directory. However, for every mod, all files from half-life.gcf will be used as well, although not actually copied to the modfolder on game load. For cstrike, DoD, OpFor and other Valve-made/-owned GoldScr mods, their very own *.gcf-files will be loaded as well. So, is there any way to check for file in the gcfs, and, if possible, find out what the name of the mod's *.gcf-file is, if at all?

fysiks 06-01-2009 18:25

Re: Search for files in *.gcf files
 
If you find it in a gcf on your computer you can just precache it (hardcoded) in your plugin. afaik

HLDS doesn't use gcf files.

Arkshine 06-01-2009 18:35

Re: Search for files in *.gcf files
 
LoadFileForMe() can load .gcf files.

ConnorMcLeod 06-01-2009 18:42

Re: Search for files in *.gcf files
 
Quote:

Originally Posted by arkshine (Post 839765)
LoadFileForMe() can load .gcf files.

Description is not avaible in the wiki.
Code:

/**
 * Loads a file using the LoadFileForMe engine function.
 *
 * The data is truncated if there is not enough space.  No null-terminator
 * is applied; the data is the raw contents of the file.
 *
 * @param file                        File to load (may be a file from the GCF).
 * @param buffer                Buffer to store file contents.
 * @param maxlength                Maximum size of the file buffer.
 * @param length                Variable to store the file length.  This may return
 *                                                a number larger than the buffer size.
 * @return                                -1 if the file could not be loaded.  Otherwise,
 *                                                the number of cells actually written to the buffer
 *                                                are returned.
 */
native LoadFileForMe(const file[], buffer[], maxlength, &length=0);


Silencer123 06-01-2009 18:52

Re: Search for files in *.gcf files
 
Thanks for the replies, but wow, I expected some functions specially for use with gcf-files. I don't feel like deciphering an ASCII-string with 400-million arrays just to check if some guy on a listenserver typed in the correct file path. Anyway, thanks for the answers. =)


All times are GMT -4. The time now is 14:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.