Raised This Month: $ Target: $400
 0% 

Dump files ending with .dem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 07-03-2007 , 14:00   Dump files ending with .dem
Reply With Quote #1

Hello,

I want to dump all the files ending on .dem (demo files) into a menu.
I can make the menu myself but not the function to get the filenames. and I would be happy if somone can create this for me.


Thanks for your help,
Ramon
__________________
Um, hi.
Ramono is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-03-2007 , 14:35   Re: Dump files ending with .dem
Reply With Quote #2

Try this:

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "stupok69"

#define MAX_FILES 32
#define MAX_FILENAME 64

#define DEM_DIR "."

new dem_files[MAX_FILES][MAX_FILENAME]

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	new buffer[MAX_FILENAME], count
	
	new dh = open_dir(DEM_DIR, buffer, MAX_FILENAME-1)
	
	if(!dh) return PLUGIN_HANDLED
	
	if(containi(buffer, ".dem") != -1)
	{
		dem_files[count] = buffer
		count++
	}
	
	while(next_file(dh, buffer, MAX_FILENAME-1)
	{
		if(containi(buffer, ".dem") != -1)
		{
			if(count < MAX_FILES)
			{
				dem_files[count] = buffer
				count++
			}
			else
			{
				server_print("Too many .dem files!")
				break
			}
		}
	}
	
	close_dir(dh)
}
stupok is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 07-03-2007 , 15:51   Re: Dump files ending with .dem
Reply With Quote #3

Works, Thank you!
__________________
Um, hi.
Ramono is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:26.


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