| Author |
Topic: Reading a file |
| przemekh10 |
General Member Since: Aug 16, 2012 Posts: 17 Last: Jan 28, 2013 [view latest posts] |
|
|
|
|
| IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Saturday, Aug. 18, 2012 04:45 pm |
 |
|
 |
|
|
| przemekh10 |
General Member Since: Aug 16, 2012 Posts: 17 Last: Jan 28, 2013 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Aug. 19, 2012 02:40 am |
 |
Doesnt work to me :( Don't know why.
Code:
filenum = OpenFile( "test.txt", "read" );
if (filenum != -1)
{
iprintlnbold("File openned!");
}
I tried to put file test.txt everywhere. In:
cod2\
cod2\main\
cod2\main\scriptdata\
And still "filenum" returns "-1"
|
 |
|
|
| liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
 |
|
Category: CoD2 Scripting Posted: Sunday, Aug. 19, 2012 04:52 am |
 |
przemekh10 writes...Quote: Doesnt work to me :( Don't know why.
Code:
filenum = OpenFile( "test.txt", "read" );
if (filenum != -1)
{
iprintlnbold("File openned!");
}
I tried to put file test.txt everywhere. In:
cod2\
cod2\main\
cod2\main\scriptdata\
And still "filenum" returns "-1"
are you testing on a local server? if you are testing localy the read function dosnt work. its stupid but yeah i had to learn that the hard way. |
 |
|
|
| Mitch* |
 |
General Member Since: Jan 23, 2007 Posts: 24 Last: Nov 10, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Aug. 19, 2012 04:56 am |
 |
liltc64 writes...Quote: przemekh10 writes...Quote: Doesnt work to me :( Don't know why.
Code:
filenum = OpenFile( "test.txt", "read" );
if (filenum != -1)
{
iprintlnbold("File openned!");
}
I tried to put file test.txt everywhere. In:
cod2\
cod2\main\
cod2\main\scriptdata\
And still "filenum" returns "-1"
are you testing on a local server? if you are testing localy the read function dosnt work. its stupid but yeah i had to learn that the hard way.
Indeed. Dedicated needs to be 2 or 1 (not sure). It seems reading fails when you test it locally. (I thought only writing works locally)
Edit: Always close the file when the filenum isn't -1. Otherwise this will cause your server to crash when a new map gets loaded.
edited on Aug. 19, 2012 05:03 am by Mitch* |
 |
|
|
| IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
|
| liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
 |
|
|
| Tally |
General Member Since: Apr 21, 2005 Posts: 819 Last: Oct 26, 2012 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Aug. 19, 2012 09:27 am |
 |
liltc64 writes...Quote: przemekh10 writes...Quote: Doesnt work to me :( Don't know why.
Code:
filenum = OpenFile( "test.txt", "read" );
if (filenum != -1)
{
iprintlnbold("File openned!");
}
I tried to put file test.txt everywhere. In:
cod2\
cod2\main\
cod2\main\scriptdata\
And still "filenum" returns "-1"
are you testing on a local server? if you are testing localy the read function dosnt work. its stupid but yeah i had to learn that the hard way.
All the file functions work on a Local server for testing, you just can't map rotate, as then it doesn't work.
First map on a Local server = fine; second map = it fails. |
 |
|
|
| liltc64 |
General Member Since: Feb 12, 2007 Posts: 906 Last: Oct 22, 2012 [view latest posts] |
|
|
 |
|
Category: CoD2 Scripting Posted: Sunday, Aug. 19, 2012 11:07 am |
 |
Tally writes...Quote: liltc64 writes...Quote: przemekh10 writes...Quote: Doesnt work to me :( Don't know why.
Code:
filenum = OpenFile( "test.txt", "read" );
if (filenum != -1)
{
iprintlnbold("File openned!");
}
I tried to put file test.txt everywhere. In:
cod2\
cod2\main\
cod2\main\scriptdata\
And still "filenum" returns "-1"
are you testing on a local server? if you are testing localy the read function dosnt work. its stupid but yeah i had to learn that the hard way.
All the file functions work on a Local server for testing, you just can't map rotate, as then it doesn't work.
First map on a Local server = fine; second map = it fails.
false, iv ran into this problem enough times to say thats not true. its true it wont work on the next map and crash if you do not close the file. but the read function in general will not work for a local server. prove me otherwise and please explain what you did to make it work if you can cause iv ran into it so many times. |
 |
|
|
| IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
|
Comments: 0
LoadoutGun Crafting to the Max.
edited on Sep. 25, 2012 06:57 pm by Morp...
|
|