Just do what was posted for ArmA 1 (Credits to the user who posted that.), use debug script commands.
Install this mod (Armaholic link) -
Link, just place the PBO in the \Addons\ folder if you don't want to use a specific mod folder and launch parameter and then press ESC (Menu) and then Enter while in a mission and (Copy paste works) the following string.
player addEventHandler ["fired",{(_this select 0) setvehicleammo 1}];player addeventhandler ["hit", {_this select 0 setdamage 0}];player addeventhandler ["dammaged", {_this select 0 setdamage 0}];player SetCaptive True;
This will give unlimited ammo, godmode and the last little addition (SetCaptive) will make AI ignore you (Can be removed by just deleting that line.)
Again credits to the user who posted this for ArmA 1
(And the debug console for that title, works just fine there as well.)
EDIT: Aren't all retail versions identical though aside from Direct2Drive and some specific localizations and perhaps Steam? (Same patch so same EXE file though some might have a paul.dll file for online verification instead of disc check, D2D normally uses encryption so that's why I listed it, myself I use a digital download version of the English version which is identical to the retail aside from using Paul.dll for verification.)
[Edited by LordJB, 6/27/2009 11:15:38 AM]