Login x
User Name:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

0 Active | 233 Guests


New BF2 Mod
BF2 General
Mohaa maps on Cod2?
CoD2 MP Mapping



Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Restricted Access Topic is Locked subscribe
Author Topic: Secret functions
General Member
Since: May 6, 2006
Posts: 212
Last: Oct 31, 2006
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Jul. 6, 2006 05:32 pm
I am calling them secret since they are not in the DOCs part and I have not seen them in any GSCs before.

Trying to squeeze COD2 and find tricks to spawn clips and trigger_damage from script I "discovered" the following functions that are not documented but can be helpful. The deal with file handling, reading and writing from script.

Here a quick example and you will guess the powers, writting logs, loggin stats, when freadln works ability to have a scriptdata text file contain players with special abilities/restrictions, e.g. you could have a list of players that can be medics and give them improved ability to heal people:


filehandle = openfile("myfile.txt", "append");
fprintln(filehandle, "Hello my log\n");

Here some of the functions that I understand so far:

filehandle = openfile(filename, filemode)
Opens a file name filename in the directory scriptdata under the directory your fs_game shortcut points to. If you do not have a fs_game on your COD2 call it most likely starts in main/scriptdata. If have my fs_game set to rfsmod so the files need to be in rfsmod\scriptdata.

Returns a filehandle that represents the file from now on and this value has to be used on calls to fprintln, fgetarg, freadln and fopen as the first parameter. This filehandle is an integer and -1 means that the file could not be opened. Typically wrong file location.

filename = name of the file to open
filemode = "append" or "read" or "write" - Self explanatory

fprintln(filehandle, stringtowrite)
Writes a string to the file pointed to by the filehandle previously obtained from fileopen.

filehandle = handle returned from openfile that specifies the file to write to.

stringtowrite = string to be written to the file. This will be terminated by a comma and not as expected a linefeed. This is most likely for multi system compatability to avoid the issue with if 0c or 0a comes first. You can force a line feed with \n and use most likely similiar escape characters know from C.

Have not tested this but most likely returns the number of bytes written or -1 if not possible.

Close the file and flushes the contents

filehandle = handle returned from openfile that specifies the file to write to.

Still trying to get to work.

Have not hacked its syntax.

edited on Jul. 6, 2006 08:33 pm by sentchy

edited on Jul. 6, 2006 08:39 pm by sentchy
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends