| Author |
Topic: Reading a file |
| cod2coder |
General Member Since: Aug 16, 2012 Posts: 20 Last: Jan 10, 2016 [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 11:45 pm |
 |
|
 |
|
|
| cod2coder |
General Member Since: Aug 16, 2012 Posts: 20 Last: Jan 10, 2016 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Aug. 19, 2012 09: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 11: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 11: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 04:27 pm |
 |
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 06:07 pm |
 |
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] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|