add cod4x io builtins

This commit is contained in:
ineed bots
2023-12-01 14:27:20 -06:00
parent 21949a47da
commit dc58bf328a
2 changed files with 75 additions and 1 deletions

View File

@ -129,6 +129,54 @@ BotBuiltinIsBot()
return false;
}
/*
Opens the file
*/
BotBuiltinFileOpen( file, mode )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_fopen"] ) )
{
return [[ level.bot_builtins["fs_fopen" ]]]( file, mode );
}
return 0;
}
/*
Closes the file
*/
BotBuiltinFileClose( fh )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_fclose"] ) )
{
[[ level.bot_builtins["fs_fclose" ]]]( fh );
}
}
/*
Closes the file
*/
BotBuiltinReadLine( fh )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_readline"] ) )
{
return [[ level.bot_builtins["fs_readline" ]]]( fh );
}
return undefined;
}
/*
Closes the file
*/
BotBuiltinWriteLine( fh, contents )
{
if ( isDefined( level.bot_builtins ) && isDefined( level.bot_builtins["fs_writeline"] ) )
{
[[ level.bot_builtins["fs_writeline" ]]]( fh, contents );
}
}
/*
Returns if player is the host
*/