eval.py

eval.py is a Battlefield 2 server script that allows execution of Python code via RCON. It's much hipper than the similar command built into the debug build of the client!

Download Link

eval.py

How to Install

  1. Browse to admin/standard_admin in your server directory
  2. Edit __init__.py so it looks similar to the following. The import eval and eval.init() lines are what you need to add.
    import autobalance
    import tk_punish
    import eval
    
    autobalance.init()
    tk_punish.init()
    eval.init()
  3. Put the script in the admin/standard_admin folder.
  4. Make sure RCON is configured, then run your server. If eval.py loaded comes up in your server console it should work from there.

Usage

To use it, run eval <statement>. An example would be something like the following:

rcon> eval for i in dir(bf2.objectManager.getObjectsOfTemplate('c4_explosives')[0]): ctx.write(str(i) + '\n')

Which then might return:

__doc__
getChildren
getParent
getPosition