Raised This Month: $12 Target: $400
 3% 

Download Prob!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-03-2009 , 05:36   Download Prob!
Reply With Quote #1

I got a little bit of trouble with files to download.
The readfile doesn´t seems to work cause there is only one file downloaded by file.
Any suggestions how about to fix this?

Code:
public OnMapStart()
{
    new String:file[256];
    BuildPath(Path_SM, file, 255, "configs/downloads.ini");
    new Handle:fileh = OpenFile(file, "r");
    new String:buffer[256];
    while (ReadFileLine(fileh, buffer, sizeof(buffer)))
    {
        new len = strlen(buffer)
        if (buffer[len-1] == '\n')
            buffer[--len] = '\0';
        if (FileExists(buffer))
        {
            AddFileToDownloadsTable(buffer);
        }
        if (IsEndOfFile(fileh))
            break;
    }
 
    for (new i = 0; i < 6; i++)
    {
        PrecacheModel(g_modelAmerName[i], true);
        PrecacheModel(g_modelAxisName[i], true);
    }
}
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Cooltad
Veteran Member
Join Date: Apr 2008
Old 05-03-2009 , 06:11   Re: Download Prob!
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=91492

That should give you some insight to making something download and precache.
__________________
Please, give me some rep if you found what I posted useful. :]
Cooltad is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-03-2009 , 07:29   Re: Download Prob!
Reply With Quote #3

Nice one but that was not my question.
Nevermind THX to you.
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-05-2009 , 03:46   Re: Download Prob!
Reply With Quote #4

andi67@: i use something similar which just adds everything to the downloadables table and precaches mdl files...
Code:
public OnMapStart()
{
	decl String:File[260]; // max platform path for win i think.
	BuildPath(Path_SM, File, sizeof(File), "blah/blah/downloads.ini");
	new Handle:FileHndl = OpenFile(File, "r");
	decl String:buffer[260];
	while (ReadFileLine(FileHndl, buffer, sizeof(buffer)))
	{
		new len = strlen(buffer);
		if(buffer[len-1] == '\n')
			buffer[--len] = '\0';
		
		if (FileExists(buffer))
		{
			AddFileToDownloadsTable(buffer);
			
			if(StrEqual(buffer[len-3], "mdl"))
				PrecacheModel(buffer, true);
		}
		
		if (IsEndOfFile(FileHndl))
		{
			CloseHandle(FileHndl);	
			break;
		}
	}
}
just put everything int that ini file..
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-05-2009 , 05:49   Re: Download Prob!
Reply With Quote #5

THX , I will check this out.
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-05-2009 , 17:10   Re: Download Prob!
Reply With Quote #6

doesn´t work , still the same as in first post.
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<
andi67 is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-05-2009 , 17:33   Re: Download Prob!
Reply With Quote #7

paste ur downloads.ini
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
andi67
Veteran Member
Join Date: Mar 2007
Location: Somewhere near you!!!
Old 05-06-2009 , 03:17   Re: Download Prob!
Reply With Quote #8

THX

I got this error :

L 05/05/2009 - 22:50:43: [SM] Native "ReadFileLine" reported: Invalid file handle 0 (error 4)
Attached Files
File Type: ini classdownloads.ini (2.2 KB, 139 views)
__________________
Waiting for HL3,Day of Defeat3 ,but will it ever come? So I'm gonna play COD WW2.>>>>SM_SKINCHOOSER<<<<
>>You need Models for DODS/CSS/CSGO , than click here!!!<<

Last edited by andi67; 05-06-2009 at 03:54.
andi67 is offline
Fredd
Veteran Member
Join Date: Jul 2007
Old 05-06-2009 , 19:50   Re: Download Prob!
Reply With Quote #9

That's weird it works fine here, make sure it's pointing to the right file path.
__________________
Need a private coder? AMXX, SourceMOD, MMS? PM me!
Fredd is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 05-06-2009 , 20:11   Re: Download Prob!
Reply With Quote #10

Quote:
Originally Posted by andi67 View Post
L 05/05/2009 - 22:50:43: [SM] Native "ReadFileLine" reported: Invalid file handle 0 (error 4)
The open failed. Make sure the downloads.ini file is indeed in the location it is supposed to be in.
naris 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 12:11.


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